else SaveModificationsBt.setEnabled(true);
}
@Override
public void actionPerformed(ActionEvent AE) {
DBHandler DBH=Parent.getDBHandler();
if(AE.getSource()==AddBt){
String newUser=AdduserBox.getText();
DBH.MySQLinsert("INSERT into UserAccount values('"+newUser+"','"+AddPass.getText()+"','"+AddUserType.getSelectedItem()+"');",ErrorAdd);
setComboBoxItems(UserBox);
setComboBoxItems(DelUserBox);
UserBox.setSelectedItem(newUser);
AdduserBox.setText("");
AddPass.setText("");
AddPass.setEditable(false);
AddBt.setEnabled(false);
if(ErrorAdd.getText().length()==0){
CheckLbl.setIcon(Parent.getCheckImage());
CheckLbl.setText("Insertion Complete");
}
SaveModificationsBt.setEnabled(false);
}
else if(AE.getSource()==DelBt){
try {
DBH.MySQLUpdate("DELETE FROM UserAccount where Username='"+DelUserBox.getSelectedItem()+"';");
} catch (SQLException e) {
// TODO Auto-generated catch block
ErrorDel.setForeground(Color.RED);
ErrorDel.setText("Error in deleting");
}
setComboBoxItems(UserBox);
setComboBoxItems(DelUserBox);
}
else if(AE.getSource()==SaveModificationsBt&&NameBox.getText().length()>0){
User Selected=Users.get(UserBox.getSelectedIndex());
String name=Selected.getUserName(),Pass=Selected.getUserPassword();
try {
DBH.MySQLUpdate("UPDATE UserAccount SET Username='"+NameBox.getText()+"',Password='"+PassBox.getText()
+"',UserType='"+UserTypeBox.getSelectedItem()+"' WHERE Username='"+UserBox.getSelectedItem()+"';");
} catch (SQLException e) {
// TODO Auto-generated catch block
NameBox.setText(name);
PassBox.setText(Pass);