Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
 
e2ae30e55bc2a997923463dd2a1274c67fdc73a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package gui;

import java.awt.Color;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

import businessLogic.LoginManager;
import businessLogic.LoginManagerInterface;
import domain.Owner;

public class LoginGUI 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 LoginGUI() {
		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) {

				jButton_ActionPerformed(arg0);	
				}					
			});
			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;
	}
	
	private void jButton_ActionPerformed(ActionEvent e){
		Owner owner = loginManager.checkCredentials(usernameField.getText(),new String(passwordField.getPassword()));
		if(owner==null){
			loginFeedback.setText("Incorrect username or password");
		}else{
			
			
			
				this.setVisible(false);
				Frame a = new OwnerMenuGUI(owner);
				a.setVisible(true);
		}	

	}

}  // @jve:decl-index=0:visual-constraint="222,33"

Commits for RRRRHHHH_CoderuralHouses/src/gui/LoginGUI.java

Diff revisions: vs.
Revision Author Commited Message
e2ae30 ... Diff Diff Eneko Pinzolas Murua Tue 14 Apr, 2015 15:07:35 +0000

imports leaned

a92725 ... Diff Diff pinene picture pinene Fri 06 Mar, 2015 09:41:12 +0000

implemented lacking GUIs and corrected errors

553879 ... camjan Wed 04 Mar, 2015 18:42:47 +0000

House Features added and logic for adding options to the owner