@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == btnNewButton) {
			String usernameText = usernameField.getText();
			Staff user = null;
			for (Person person : staffList) {
				if (person.getName().equals(usernameText)) {
					user = (Staff) person;
					break;
				}
			}
			if (user != null) {
				char[] validate = passwordField.getPassword();
				login = ((Staff) user).passwordValidation(validate);
				if (login) {
					gui = new MainGUI(user, driver);
					driver.setGui(gui);
					if (((Staff) user).getAccessLevel() == 2) {
						gui.getSupplierTab().enableButtons(true);
						gui.getCustomerTab().enableButtons(true);
						gui.getStaffTab().enableButtons(true);
						gui.getProductTab().enableButtons(true);
						RetailSystemDriver.setPriviledged(true);
						gui.setVisible(true);
						setVisible(false);
					}
					else {
						
						gui.getSupplierTab().enableButtons(false);
						gui.getCustomerTab().enableButtons(false);
						gui.getStaffTab().enableButtons(false);
						gui.getProductTab().enableButtons(false);
						RetailSystemDriver.setPriviledged(false);
						gui.setVisible(true);
						setVisible(false);
					}

					setVisible(false);
					//JOptionPane.showMessageDialog(null, "Login successful!");
				}
				else
					JOptionPane.showMessageDialog(null, "Wrong Password!");
			}
			else
				JOptionPane.showMessageDialog(null, "Invalid username!");
		}
	}