Advertisement
Guest User

Untitled

a guest
Jan 9th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.28 KB | None | 0 0
  1. package frauas.fb2.project.ordermanagement.view;
  2.  
  3. import javax.swing.JFrame;
  4. import javax.swing.JLabel;
  5. import javax.swing.JOptionPane;
  6.  
  7. import java.awt.Font;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10.  
  11. import javax.swing.ButtonGroup;
  12. import javax.swing.JFormattedTextField;
  13. import javax.swing.SwingConstants;
  14. import javax.swing.GroupLayout;
  15. import javax.swing.GroupLayout.Alignment;
  16. import javax.swing.JPasswordField;
  17. import javax.swing.JTextField;
  18. import javax.swing.LayoutStyle.ComponentPlacement;
  19. import javax.swing.JButton;
  20.  
  21. import java.awt.Color;
  22.  
  23. import javax.swing.JRadioButton;
  24. import javax.swing.JComboBox;
  25. import javax.swing.DefaultComboBoxModel;
  26.  
  27. import frauas.fb2.project.ordermanagement.beans.User;
  28. import frauas.fb2.project.ordermanagement.controler.LoginControler;
  29. /**
  30. * This class is for the registration window.
  31. *
  32. * @author James Toribio
  33. * @version 1.0
  34. */
  35. public class SignUpView extends JFrame implements ActionListener{
  36.  
  37. /**
  38. *
  39. */
  40.  
  41. /*Some global Variables*/
  42. private static final long serialVersionUID = 1L;
  43. public JFrame frmSignUp;
  44. private JPasswordField passwordField;
  45. private JTextField textField;
  46. private JTextField txtFirstName;
  47. private JTextField txtPhoneNo;
  48. private JTextField txtEmail;
  49. private JTextField txtBIC;
  50. private JTextField textField_2;
  51. private JTextField txtLastName;
  52. private JTextField txtAddress;
  53. private JTextField txtZip;
  54. private JTextField txtCity;
  55. private JPasswordField passwordField_Confirm;
  56. private JTextField txtIBAN;
  57. private JRadioButton rdbtnCourier;
  58. private JRadioButton rdbtnInstitution;
  59. private JComboBox<String> comboBox;
  60. private User newUser;
  61.  
  62. /**
  63. * Launch the application.
  64. */
  65. public void run() {
  66. try {
  67. SignUpView window = new SignUpView();
  68. window.frmSignUp.setVisible(true);
  69. } catch (Exception e) {
  70. e.printStackTrace();
  71. }
  72. }
  73.  
  74. /**
  75. * Create the application.
  76. */
  77. public SignUpView() {
  78. initialize();
  79. }
  80.  
  81. /**
  82. * Initialize the contents of the frame.
  83. */
  84. private void initialize() {
  85. frmSignUp = new JFrame();
  86. frmSignUp.setTitle("Courier task tool - Sign Up");
  87. frmSignUp.getContentPane().setBackground(Coloring.LoginBackground);
  88. frmSignUp.setBounds(100, 100, 900, 650);
  89. frmSignUp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  90. frmSignUp.setLocationRelativeTo(null);
  91. frmSignUp.setResizable(false);
  92.  
  93. JLabel lblLogin = new JLabel("Registration");
  94. lblLogin.setForeground(new Color(255, 255, 255));
  95. lblLogin.setVerticalAlignment(SwingConstants.BOTTOM);
  96. lblLogin.setHorizontalAlignment(SwingConstants.CENTER);
  97. lblLogin.setFont(new Font("Tahoma", Font.BOLD, 40));
  98.  
  99. JLabel lblEmail = new JLabel("E-Mail:");
  100. lblEmail.setForeground(new Color(255, 255, 255));
  101. lblEmail.setFont(new Font("Tahoma", Font.PLAIN, 20));
  102.  
  103. JLabel lblPassword = new JLabel("Password:");
  104. lblPassword.setForeground(new Color(255, 255, 255));
  105. lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 20));
  106.  
  107. passwordField = new JPasswordField();
  108.  
  109. textField = new JTextField();
  110. textField.setColumns(10);
  111.  
  112. JButton btnSignUp = new JButton("Save");
  113. btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 15));
  114. btnSignUp.addActionListener(this);
  115. btnSignUp.setActionCommand("cmd_save");
  116.  
  117. JLabel lblName = new JLabel("First name:");
  118. lblName.setForeground(new Color(255, 255, 255));
  119. lblName.setFont(new Font("Tahoma", Font.PLAIN, 20));
  120.  
  121. JLabel lblAddress = new JLabel("<html>Street name and <br>house number:</html>");
  122. lblAddress.setForeground(new Color(255, 255, 255));
  123. lblAddress.setFont(new Font("Tahoma", Font.PLAIN, 20));
  124.  
  125. JLabel lblCountry = new JLabel("Country:");
  126. lblCountry.setForeground(Color.WHITE);
  127. lblCountry.setFont(new Font("Tahoma", Font.PLAIN, 20));
  128.  
  129. JLabel lblPhoneNumber = new JLabel("Confirm Password:");
  130. lblPhoneNumber.setForeground(Color.WHITE);
  131. lblPhoneNumber.setFont(new Font("Tahoma", Font.PLAIN, 20));
  132.  
  133. JLabel lblAccountInformations = new JLabel("Account Informations:");
  134. lblAccountInformations.setForeground(Color.WHITE);
  135. lblAccountInformations.setFont(new Font("Tahoma", Font.PLAIN, 20));
  136.  
  137. rdbtnCourier = new JRadioButton("Courier");
  138. rdbtnCourier.setForeground(Color.WHITE);
  139. rdbtnCourier.setFont(new Font("Tahoma", Font.PLAIN, 15));
  140. rdbtnCourier.setBackground(Coloring.LoginBackground);
  141. rdbtnCourier.setActionCommand("CourierRadio");
  142. rdbtnCourier.addActionListener(this);
  143. rdbtnCourier.setSelected(true);
  144.  
  145.  
  146.  
  147. JLabel lblRegisterAs = new JLabel("Register as:");
  148. lblRegisterAs.setForeground(Color.WHITE);
  149. lblRegisterAs.setFont(new Font("Tahoma", Font.PLAIN, 20));
  150.  
  151. rdbtnInstitution = new JRadioButton("Institution");
  152. rdbtnInstitution.setForeground(Color.WHITE);
  153. rdbtnInstitution.setFont(new Font("Tahoma", Font.PLAIN, 15));
  154. rdbtnInstitution.setBackground(Coloring.LoginBackground);
  155. rdbtnInstitution.setActionCommand("InstitutionRadio");
  156. rdbtnInstitution.addActionListener(this);
  157.  
  158. /*Adding a ButtonGroup for Courier Radio- and Institution RadioButton*/
  159.  
  160. ButtonGroup btnGroup = new ButtonGroup();
  161. btnGroup.add(rdbtnCourier);
  162. btnGroup.add(rdbtnInstitution);
  163.  
  164. txtFirstName = new JTextField();
  165. txtFirstName.setColumns(10);
  166.  
  167. txtPhoneNo = new JTextField();
  168. txtPhoneNo.setColumns(10);
  169.  
  170. txtEmail = new JTextField();
  171.  
  172. JLabel label = new JLabel("Phone number:");
  173. label.setForeground(Color.WHITE);
  174. label.setFont(new Font("Tahoma", Font.PLAIN, 20));
  175.  
  176. txtBIC = new JTextField();
  177. txtBIC.setColumns(10);
  178.  
  179.  
  180. /*################################################### LAYOUT START #####################################################################################*/
  181.  
  182. comboBox = new JComboBox<>();
  183. comboBox.setFont(new Font("Tahoma", Font.PLAIN, 12));
  184. comboBox.setToolTipText("Choose your country");
  185. comboBox.setModel(new DefaultComboBoxModel<String>(new String[] {"Australia", "Belgium", "Germany", "USA"}));
  186.  
  187. textField_2 = new JTextField();
  188. textField_2.setColumns(10);
  189.  
  190. JLabel lblLastName = new JLabel("Last name:");
  191. lblLastName.setForeground(Color.WHITE);
  192. lblLastName.setFont(new Font("Tahoma", Font.PLAIN, 20));
  193.  
  194. txtLastName = new JTextField();
  195. txtLastName.setColumns(10);
  196.  
  197. JLabel lblIban = new JLabel("IBAN:");
  198. lblIban.setForeground(Color.WHITE);
  199. lblIban.setFont(new Font("Tahoma", Font.PLAIN, 20));
  200.  
  201. JLabel lblBic = new JLabel("BIC:");
  202. lblBic.setForeground(Color.WHITE);
  203. lblBic.setFont(new Font("Tahoma", Font.PLAIN, 20));
  204.  
  205. txtAddress = new JTextField();
  206. txtAddress.setColumns(10);
  207.  
  208. txtZip = new JFormattedTextField();
  209. txtZip.setColumns(10);
  210.  
  211. JLabel lblZipCode = new JLabel("Zipcode:");
  212. lblZipCode.setForeground(Color.WHITE);
  213. lblZipCode.setFont(new Font("Tahoma", Font.PLAIN, 20));
  214.  
  215. JLabel lblCity = new JLabel("City:");
  216. lblCity.setForeground(Color.WHITE);
  217. lblCity.setFont(new Font("Tahoma", Font.PLAIN, 20));
  218.  
  219. txtCity = new JTextField();
  220. txtCity.setColumns(10);
  221.  
  222. passwordField_Confirm = new JPasswordField();
  223.  
  224. txtIBAN = new JTextField();
  225. txtIBAN.setColumns(10);
  226.  
  227. JButton btnCancel = new JButton("Cancel");
  228. btnCancel.setFont(new Font("Tahoma", Font.BOLD, 15));
  229. btnCancel.setActionCommand("cmd_cancel");
  230. btnCancel.addActionListener(this);
  231.  
  232. GroupLayout groupLayout = new GroupLayout(frmSignUp.getContentPane());
  233. groupLayout.setHorizontalGroup(
  234. groupLayout.createParallelGroup(Alignment.LEADING)
  235. .addGroup(groupLayout.createSequentialGroup()
  236. .addGap(55)
  237. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  238. .addGroup(groupLayout.createSequentialGroup()
  239. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  240. .addComponent(lblZipCode, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  241. .addComponent(lblCity, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  242. .addComponent(lblCountry, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  243. .addComponent(label, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  244. .addComponent(lblEmail, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  245. .addComponent(lblPassword, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  246. .addComponent(lblPhoneNumber, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))
  247. .addGap(10))
  248. .addGroup(groupLayout.createSequentialGroup()
  249. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  250. .addComponent(lblLastName, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  251. .addComponent(lblAddress, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
  252. .addGroup(groupLayout.createSequentialGroup()
  253. .addPreferredGap(ComponentPlacement.RELATED)
  254. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  255. .addComponent(lblRegisterAs, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE)
  256. .addComponent(lblName, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))))
  257. .addPreferredGap(ComponentPlacement.UNRELATED)))
  258. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  259. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
  260. .addComponent(comboBox, 0, 176, Short.MAX_VALUE)
  261. .addComponent(txtCity)
  262. .addComponent(txtEmail)
  263. .addComponent(txtZip, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
  264. .addComponent(txtPhoneNo))
  265. .addGroup(groupLayout.createSequentialGroup()
  266. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  267. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
  268. .addComponent(txtLastName, Alignment.LEADING)
  269. .addComponent(txtFirstName, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))
  270. .addGroup(groupLayout.createSequentialGroup()
  271. .addComponent(rdbtnCourier)
  272. .addGap(18)
  273. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  274. .addComponent(lblLogin)
  275. .addGroup(groupLayout.createSequentialGroup()
  276. .addComponent(rdbtnInstitution)
  277. .addGap(122)
  278. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  279. .addComponent(lblAccountInformations, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)
  280. .addGroup(groupLayout.createSequentialGroup()
  281. .addComponent(btnSignUp, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE)
  282. .addGap(18)
  283. .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE)
  284. .addPreferredGap(ComponentPlacement.RELATED))
  285. .addGroup(groupLayout.createSequentialGroup()
  286. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  287. .addComponent(lblIban)
  288. .addComponent(lblBic, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE))
  289. .addGap(18)
  290. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  291. .addComponent(txtBIC, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
  292. .addComponent(txtIBAN, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE))))))))
  293. .addGap(292))
  294. .addComponent(txtAddress, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  295. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
  296. .addComponent(passwordField, Alignment.LEADING)
  297. .addComponent(passwordField_Confirm, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)))
  298. .addGap(30)
  299. .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
  300. .addGap(40)
  301. .addComponent(textField, 177, 177, Short.MAX_VALUE)
  302. .addContainerGap())
  303. );
  304. groupLayout.setVerticalGroup(
  305. groupLayout.createParallelGroup(Alignment.LEADING)
  306. .addGroup(groupLayout.createSequentialGroup()
  307. .addGap(29)
  308. .addComponent(lblLogin)
  309. .addGap(47)
  310. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  311. .addGroup(groupLayout.createSequentialGroup()
  312. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  313. .addComponent(textField, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
  314. .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
  315. .addComponent(lblRegisterAs, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
  316. .addComponent(rdbtnCourier)
  317. .addComponent(rdbtnInstitution)))
  318. .addPreferredGap(ComponentPlacement.UNRELATED))
  319. .addGroup(groupLayout.createSequentialGroup()
  320. .addComponent(lblAccountInformations, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
  321. .addGap(15)))
  322. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  323. .addGroup(groupLayout.createSequentialGroup()
  324. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  325. .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
  326. .addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
  327. .addComponent(lblName, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
  328. .addComponent(txtFirstName, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
  329. .addPreferredGap(ComponentPlacement.RELATED)
  330. .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
  331. .addComponent(txtLastName, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
  332. .addComponent(lblLastName, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)))
  333. .addGroup(groupLayout.createSequentialGroup()
  334. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  335. .addComponent(txtBIC, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
  336. .addComponent(lblIban, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
  337. .addPreferredGap(ComponentPlacement.UNRELATED)
  338. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  339. .addComponent(txtIBAN, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
  340. .addComponent(lblBic, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))))
  341. .addPreferredGap(ComponentPlacement.UNRELATED)
  342. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  343. .addComponent(txtAddress, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
  344. .addComponent(lblAddress, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE))
  345. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  346. .addGroup(groupLayout.createSequentialGroup()
  347. .addGap(9)
  348. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  349. .addComponent(lblZipCode, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
  350. .addComponent(txtZip, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
  351. .addPreferredGap(ComponentPlacement.RELATED)
  352. .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
  353. .addComponent(lblCity, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
  354. .addComponent(txtCity, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
  355. .addPreferredGap(ComponentPlacement.RELATED)
  356. .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
  357. .addComponent(lblCountry, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
  358. .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
  359. .addGap(11)
  360. .addComponent(txtPhoneNo, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
  361. .addGroup(groupLayout.createSequentialGroup()
  362. .addGap(109)
  363. .addComponent(label, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)))
  364. .addGap(9)
  365. .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
  366. .addComponent(txtEmail, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE)
  367. .addComponent(lblEmail))
  368. .addPreferredGap(ComponentPlacement.UNRELATED)
  369. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  370. .addComponent(lblPassword)
  371. .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
  372. .addPreferredGap(ComponentPlacement.UNRELATED)
  373. .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
  374. .addGroup(groupLayout.createSequentialGroup()
  375. .addComponent(passwordField_Confirm, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
  376. .addGap(24)
  377. .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
  378. .addComponent(btnSignUp, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE)
  379. .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE)))
  380. .addComponent(lblPhoneNumber, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
  381. .addContainerGap(26, Short.MAX_VALUE))
  382. );
  383. frmSignUp.getContentPane().setLayout(groupLayout);
  384. }
  385. /*########################################################## LAYOUT END #######################################################################################*/
  386. /**
  387. * Performs actions when Button is clicked
  388. *
  389. */
  390. @Override
  391. // Actions that will be executed when the corresponding button is clicked.
  392. public void actionPerformed(ActionEvent e)
  393. {
  394.  
  395. /*Radio Button Courier*/
  396. if("CourierRadio".equals(e.getActionCommand()))
  397. {
  398.  
  399. LoginControler ctr = LoginControler.getInstance();
  400.  
  401. /*Create local variables*/
  402. // String[] firstName = new String[50];
  403. // String[] lastName = new String[50];
  404. // String[] address = new String[50];
  405. // String[] accInfo = new String[30];
  406. // int[] phoneNo = new int[15];
  407. // String[] eMail = new String[50];
  408.  
  409. // frmSignUp.dispose();
  410. // LoginView login_window = new LoginView();
  411. // login_window.run();
  412. }
  413.  
  414. /*Radio Button Institution*/
  415. else if("InstitutionRadio".equals(e.getActionCommand()))
  416. {
  417.  
  418. // LoginControler ctr = new LoginControler();
  419. //
  420. // /*Create local variables*/
  421. // String[] firstName = new String[50];
  422. // String[] lastName = new String[50];
  423. // String[] address = new String[50];
  424. // String[] accInfo = new String[30];
  425. // int[] phoneNo = new int[15];
  426. // String[] eMail = new String[50];
  427. //
  428. // frmSignUp.dispose();
  429. // LoginView login_window = new LoginView();
  430. // login_window.run();
  431. }
  432.  
  433.  
  434.  
  435. /*Save*/
  436. else if("cmd_save".equals(e.getActionCommand()))
  437. {
  438. LoginControler ctr = LoginControler.getInstance();
  439. //start
  440. String userid = "1";
  441. String name = txtFirstName.getText() + " " + txtLastName.getText();
  442. String address = txtAddress.getText() + ", " + txtZip.getText() +" "+txtCity.getText();
  443. String country = (String) comboBox.getSelectedItem();
  444. String accountinfo = "IBAN:" + txtIBAN.getText() + ", BIC:" + txtBIC.getText();
  445. String phoenenumber = txtPhoneNo.getText();
  446. String email = txtEmail.getText();
  447. String pass = passwordField.getText();
  448. String role = "";
  449. if(rdbtnCourier.isSelected())
  450. {
  451. role = "Courier";
  452. }else if(rdbtnInstitution.isSelected())
  453. {
  454. role = "Customer";
  455. }
  456.  
  457. newUser = new User(userid, name, address, country, accountinfo, phoenenumber, email, pass, role, 0, false);
  458. try
  459. {
  460. ctr.register(newUser);
  461. }catch(Exception e1)
  462. {
  463. e1.printStackTrace();
  464. }
  465. JOptionPane.showMessageDialog(null, "Der Benutzer wurde Erfolgreich eingefügt.", "Erfolgreich eingefügt", JOptionPane.INFORMATION_MESSAGE);
  466. //ende
  467.  
  468. /*Create local variables (to assign to the database (?)) | MAYBE NOT NEEDED*/
  469. // String[] firstName = new String[50];
  470. // String[] lastName = new String[50];
  471. // String[] address = new String[50];
  472. // String[] accInfo = new String[30];
  473. // int[] phoneNo = new int[15];
  474. // String[] eMail = new String[50];
  475.  
  476. // frmSignUp.dispose();
  477. // LoginView login_window = new LoginView();
  478. // login_window.run();
  479. }
  480.  
  481. /*Cancel*/
  482. else if("cmd_cancel".equals(e.getActionCommand()))
  483. {
  484. frmSignUp.dispose();
  485. LoginView login_window = new LoginView();
  486. login_window.run();
  487. }
  488. }
  489. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement