import businessLogic.LoginManager;
import businessLogic.LoginManagerInterface;
+import domain.Account;
import domain.Owner;
+import javax.swing.JRadioButton;
+import javax.swing.ButtonGroup;
+
public class LoginGUI extends JFrame {
private static final long serialVersionUID= 1L;
private JPasswordField passwordField;
private LoginManagerInterface loginManager = new LoginManager();
private JLabel loginFeedback;
-
+ private final ButtonGroup buttonGroup = new ButtonGroup();
public LoginGUI() {
super();
initialize();
}
private void jButton_ActionPerformed(ActionEvent e){
- Owner owner = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword()));
- if(owner==null){
- loginFeedback.setText("Incorrect username or password");
- }else{
-
-
+ Account acc = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword()));
+ if (acc.getAdmin()) {
+ this.setVisible(false);
+ Frame a = new AdminMenuGUI();
+ a.setVisible(true);
+ } else {
+ if(acc.getOwner()==null){
+ loginFeedback.setText("Incorrect username or password");
+ }else{
this.setVisible(false);
- Frame a = new OwnerMenuGUI(owner);
- a.setVisible(true);
- }
-
+ Frame a = new OwnerMenuGUI(acc.getOwner());
+ a.setVisible(true);
+ }
+ }
+
}
-
} // @jve:decl-index=0:visual-constraint="222,33"