RRRRHHHH_Code
4f8bcc7fa6ac7640915ac3aa5e115b6d37c08a86
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
package gui; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.rmi.Naming; import java.rmi.RemoteException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import common.AdminInterface; import configuration.___IntNames; import domain.Account; import domain.Owner; public class OwnerRegistrationGUI extends JFrame { private JPanel panel; private JTextField nameField; private JTextField userNameField; private AdminInterface am = null; private JTextField passField; private JTextField bank1Field; private JTextField bank2Field; private JTextField bank3Field; private JTextField bank4Field; private JTextField emailField; private JLabel lblWhenAcceptedYou; private JLabel feedback; /** * Create the frame. */ public OwnerRegistrationGUI() { try { am = (AdminInterface) Naming .lookup(___IntNames.AdminManager); } catch (Exception e1) { System.out.println("Error accessing remote authentication: " + e1.toString()); } setTitle("Owner registration"); setBounds(100, 100, 500, 400); panel = new JPanel(); panel.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(panel); panel.setLayout(null); JLabel nameLb = new JLabel("Name:"); nameLb.setBounds(37, 45, 46, 14); panel.add(nameLb); nameField = new JTextField(); nameField.setBounds(147, 42, 86, 20); panel.add(nameField); nameField.setColumns(10); JLabel lblUsername = new JLabel("Username:"); lblUsername.setBounds(37, 212, 69, 14); panel.add(lblUsername); userNameField = new JTextField(); userNameField.setBounds(147, 209, 86, 20); panel.add(userNameField); userNameField.setColumns(10); JLabel lblPassword = new JLabel("Password:"); lblPassword.setBounds(37, 258, 69, 14); panel.add(lblPassword); passField = new JTextField(); passField.setBounds(147, 255, 86, 20); panel.add(passField); passField.setColumns(10); JLabel lblBankAccount = new JLabel("Bank account:"); lblBankAccount.setBounds(37, 94, 69, 14); panel.add(lblBankAccount); bank1Field = new JTextField(); bank1Field.setBounds(147, 91, 61, 20); panel.add(bank1Field); bank2Field = new JTextField(); bank2Field.setBounds(218, 91, 61, 20); panel.add(bank2Field); bank3Field = new JTextField(); bank3Field.setBounds(289, 91, 32, 20); panel.add(bank3Field); bank4Field = new JTextField(); bank4Field.setBounds(331, 91, 117, 20); panel.add(bank4Field); JButton btnSendRegistrationRequest = new JButton( "Send registration request"); btnSendRegistrationRequest.setBounds(127, 316, 194, 23); btnSendRegistrationRequest.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { jButton_ActionPerformed(arg0); } }); panel.add(btnSendRegistrationRequest); JLabel lblEmail = new JLabel("E-mail:"); lblEmail.setBounds(37, 155, 46, 14); panel.add(lblEmail); emailField = new JTextField(); emailField.setBounds(147, 152, 148, 20); panel.add(emailField); emailField.setColumns(10); lblWhenAcceptedYou = new JLabel( "When accepted you will receive an e-mail"); lblWhenAcceptedYou.setForeground(Color.GREEN); lblWhenAcceptedYou.setBounds(127, 291, 214, 14); panel.add(lblWhenAcceptedYou); feedback = new JLabel(""); feedback.setForeground(Color.RED); feedback.setEnabled(false); feedback.setBounds(127, 344, 214, 20); panel.add(feedback); } private void jButton_ActionPerformed(ActionEvent e) { Owner own = new Owner(this.nameField.getText(), this.bank1Field.getText() + " " + this.bank2Field.getText() + " " + this.bank3Field.getText() + " " + this.bank4Field.getText(), this.emailField.getText()); Account acc = new Account(this.userNameField.getText(), this.passField.getText(), own); try { if (this.am.addAccount(acc)) { this.feedback.setText("Request sended"); } else { this.feedback.setText("Can't send the request"); } } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } |
Commits for RRRRHHHH_CoderuralHouses client/src/gui/OwnerRegistrationGUI.java
Revision | Author | Commited | Message |
---|---|---|---|
4f8bcc ... | epinzolas001 | Mon 18 May, 2015 09:49:54 +0000 | Merge conflicts solutioned |