import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
+import java.awt.Color;
public class IntroduceOfferGUI extends JFrame {
private JPanel jContentPane = null;
private JTextField usernameField;
private JPasswordField passwordField;
- private JTextField textField;
private LoginManagerInterface loginManager = new LoginManager();
+ private JLabel loginFeedback;
public IntroduceOfferGUI() {
super();
jContentPane.add(passwordTag);
usernameField = new JTextField();
- usernameField.setBounds(208, 68, 114, 19);
+ usernameField.setBounds(202, 65, 133, 25);
jContentPane.add(usernameField);
usernameField.setColumns(10);
passwordField = new JPasswordField();
- passwordField.setBounds(208, 129, 114, 18);
+ passwordField.setBounds(202, 122, 133, 25);
jContentPane.add(passwordField);
JButton loginButton = new JButton("Login");
public void actionPerformed(ActionEvent arg0) {
Owner owner = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword()));
if(owner==null){
- textField.setText("Incorrect username or password");
+ loginFeedback.setText("Incorrect username or password");
}else{
Vector<RuralHouse> ownerHouseList=null;
try{
a.setVisible(true);
}
else if(ownerHouseList.isEmpty())
- textField.setText("Login OK , but no houses in your name");
+ loginFeedback.setText("Login OK , but no houses in your name");
}
}
});
- loginButton.setBounds(151, 178, 117, 25);
+ loginButton.setBounds(164, 179, 117, 25);
jContentPane.add(loginButton);
- textField = new JTextField();
- textField.setBounds(127, 227, 185, 26);
- jContentPane.add(textField);
- textField.setColumns(10);
+ loginFeedback = new JLabel("");
+ loginFeedback.setForeground(Color.RED);
+ loginFeedback.setHorizontalAlignment(SwingConstants.CENTER);
+ loginFeedback.setBounds(83, 216, 269, 25);
+ jContentPane.add(loginFeedback);
}
return jContentPane;
}