TextField changed to Label in login GUI
authorjcampos004 <jcampos004@g004973.gi.ehu.es>
Fri, 27 Feb 2015 12:34:33 +0000 (13:34 +0100)
committerjcampos004 <jcampos004@g004973.gi.ehu.es>
Fri, 27 Feb 2015 12:34:33 +0000 (13:34 +0100)
ruralHouses/.gitignore
ruralHouses/src/configuration/Config.java
ruralHouses/src/gui/IntroduceOfferGUI.java

index ea479e5..aeb337b 100644 (file)
@@ -1,3 +1,3 @@
 /bin
 /lib
-
+/db
index 164bca9..0ddca0f 100644 (file)
@@ -13,7 +13,7 @@ public class Config {
        private final  String db4oFilename = "db/DBjcampos004.yap";
 
        //Two possible values: "open" or "initialize"
-       private final String dataBaseOpenMode="open";
+       private final String dataBaseOpenMode="initialize";
 
        private static Config theInstance = new Config();
    
index 57346c8..40083ec 100644 (file)
@@ -12,6 +12,7 @@ import domain.RuralHouse;
 
 import java.awt.event.ActionListener;
 import java.awt.event.ActionEvent;
+import java.awt.Color;
 
 public class IntroduceOfferGUI extends JFrame {
 
@@ -19,8 +20,8 @@ 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();
@@ -48,12 +49,12 @@ public class IntroduceOfferGUI extends JFrame {
                        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");
@@ -61,7 +62,7 @@ public class IntroduceOfferGUI extends JFrame {
                                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{
@@ -74,18 +75,19 @@ public class IntroduceOfferGUI extends JFrame {
                                                        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;
        }