+++ /dev/null
-package gui;
-
-import javax.swing.*;
-
-import java.awt.Frame;
-import java.awt.Rectangle;
-import java.util.Vector;
-
-import businessLogic.*;
-import domain.Owner;
-import domain.RuralHouse;
-
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.Color;
-
-public class IntroduceOfferGUI extends JFrame {
-
- private static final long serialVersionUID= 1L;
- private JPanel jContentPane = null;
- private JTextField usernameField;
- private JPasswordField passwordField;
- private LoginManagerInterface loginManager = new LoginManager();
- private JLabel loginFeedback;
-
- public IntroduceOfferGUI() {
- super();
- initialize();
- }
-
- private void initialize() {
- this.setSize(449, 293);
- this.setContentPane(getJContentPane());
- this.setTitle("Login");
-
- }
-
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
-
- JLabel usernameTag = new JLabel("Username:");
- usernameTag.setBounds(56, 67, 104, 20);
- jContentPane.add(usernameTag);
-
- JLabel passwordTag = new JLabel("Password:");
- passwordTag.setBounds(56, 132, 104, 15);
- jContentPane.add(passwordTag);
-
- usernameField = new JTextField();
- usernameField.setBounds(202, 65, 133, 25);
- jContentPane.add(usernameField);
- usernameField.setColumns(10);
-
- passwordField = new JPasswordField();
- passwordField.setBounds(202, 122, 133, 25);
- jContentPane.add(passwordField);
-
- JButton loginButton = new JButton("Login");
- loginButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- Owner owner = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword()));
- if(owner==null){
- loginFeedback.setText("Incorrect username or password");
- }else{
- Vector<RuralHouse> ownerHouseList=null;
- try{
- ownerHouseList = StartWindow.getBusinessLogic().getRuralHouses(owner);
- }catch (Exception e){
- e.printStackTrace();
- }
- if(!ownerHouseList.isEmpty()){
- Frame a = new IntroduceOffer2GUI(ownerHouseList);
- a.setVisible(true);
- }
- else if(ownerHouseList.isEmpty())
- loginFeedback.setText("Login OK , but no houses in your name");
- }
-
- }
- });
- loginButton.setBounds(164, 179, 117, 25);
- jContentPane.add(loginButton);
-
- loginFeedback = new JLabel("");
- loginFeedback.setForeground(Color.RED);
- loginFeedback.setHorizontalAlignment(SwingConstants.CENTER);
- loginFeedback.setBounds(83, 216, 269, 25);
- jContentPane.add(loginFeedback);
- }
- return jContentPane;
- }
-
-
-} // @jve:decl-index=0:visual-constraint="222,33"
-