public AddNewUser() { super("Add New User", true, false, true, true); msg = new JOptionPane(); rand = new RandomPassword(); ec = new EasyCrypt(); db = new ExecDb(); AddNewUserLayout customLayout = new AddNewUserLayout(); getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12)); getContentPane().setLayout(customLayout); accType = new JComboBox(); accType.addItem("Student"); accType.addItem("Teacher"); accType.addItem("Officer"); getContentPane().add(accType); accTxt = new JTextField(""); getContentPane().add(accTxt); label_1 = new JLabel("Add new user account", JLabel.CENTER); getContentPane().add(label_1); label_2 = new JLabel("Account Type : "); getContentPane().add(label_2); label_3 = new JLabel("Account ID : "); getContentPane().add(label_3); button_1 = new JButton("ADD"); getContentPane().add(button_1); button_2 = new JButton("CLOSE"); getContentPane().add(button_2); passTxt = new JTextField(""); passTxt.setEditable(false); getContentPane().add(passTxt); label_4 = new JLabel("Random Password : "); getContentPane().add(label_4); setSize(getPreferredSize()); accType.addItemListener(this); button_1.addActionListener(this); button_2.addActionListener(this); }
public void itemStateChanged(ItemEvent e) { acc = accType.getSelectedIndex(); }