6 import java.awt.Rectangle;
7 import java.util.Vector;
9 import businessLogic.ApplicationFacadeInterface;
11 import domain.RuralHouse;
13 import java.awt.event.ActionListener;
14 import java.awt.event.ActionEvent;
16 public class IntroduceOfferGUI extends JFrame {
18 private static final long serialVersionUID = 1L;
19 private JPanel jContentPane = null;
20 private JTextField usernameField;
21 private JPasswordField passwordField;
22 private JTextField textField;
23 private LoginManager loginManager = new LoginManagerInterface();
25 public IntroduceOfferGUI() {
30 private void initialize() {
31 this.setSize(449, 293);
32 this.setContentPane(getJContentPane());
33 this.setTitle("Login");
37 private JPanel getJContentPane() {
38 if (jContentPane == null) {
39 jContentPane = new JPanel();
40 jContentPane.setLayout(null);
42 JLabel usernameTag = new JLabel("Username:");
43 usernameTag.setBounds(56, 67, 104, 20);
44 jContentPane.add(usernameTag);
46 JLabel passwordTag = new JLabel("Password:");
47 passwordTag.setBounds(56, 132, 104, 15);
48 jContentPane.add(passwordTag);
50 usernameField = new JTextField();
51 usernameField.setBounds(208, 68, 114, 19);
52 jContentPane.add(usernameField);
53 usernameField.setColumns(10);
55 passwordField = new JPasswordField();
56 passwordField.setBounds(208, 129, 114, 18);
57 jContentPane.add(passwordField);
59 JButton loginButton = new JButton("Login");
60 loginButton.addActionListener(new ActionListener() {
61 public void actionPerformed(ActionEvent arg0) {
62 Owner owner = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword());
64 textField.setText("Incorrect username or password");
66 Vector<RuralHouse> ownerHouseList=null;
68 ownerHouseList = StartWindow.getBusinessLogic().getRuralHouses(owner);
72 if(!ownerHouseList.isEmpty()){
73 Frame a = new IntroduceOffer2GUI(ownerHouseList);
76 else if(ownerHouseList.isEmpty())
77 textField.setText("Login OK , but no houses in your name");
82 loginButton.setBounds(151, 178, 117, 25);
83 jContentPane.add(loginButton);
85 textField = new JTextField();
86 textField.setBounds(127, 227, 185, 26);
87 jContentPane.add(textField);
88 textField.setColumns(10);
92 } // @jve:decl-index=0:visual-constraint="222,33"