From a0499d6ebf41addf6546ed207b87790debeaf96c Mon Sep 17 00:00:00 2001 From: jcampos004 Date: Fri, 27 Feb 2015 13:34:33 +0100 Subject: [PATCH] TextField changed to Label in login GUI --- ruralHouses/.gitignore | 2 +- ruralHouses/src/configuration/Config.java | 2 +- ruralHouses/src/gui/IntroduceOfferGUI.java | 22 ++++++++++++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ruralHouses/.gitignore b/ruralHouses/.gitignore index ea479e5..aeb337b 100644 --- a/ruralHouses/.gitignore +++ b/ruralHouses/.gitignore @@ -1,3 +1,3 @@ /bin /lib - +/db diff --git a/ruralHouses/src/configuration/Config.java b/ruralHouses/src/configuration/Config.java index 164bca9..0ddca0f 100644 --- a/ruralHouses/src/configuration/Config.java +++ b/ruralHouses/src/configuration/Config.java @@ -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(); diff --git a/ruralHouses/src/gui/IntroduceOfferGUI.java b/ruralHouses/src/gui/IntroduceOfferGUI.java index 57346c8..40083ec 100644 --- a/ruralHouses/src/gui/IntroduceOfferGUI.java +++ b/ruralHouses/src/gui/IntroduceOfferGUI.java @@ -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 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; } -- 2.20.1