summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r--src/jrummikub/view/impl/LoginPanel.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/jrummikub/view/impl/LoginPanel.java b/src/jrummikub/view/impl/LoginPanel.java
index 5241896..4712630 100644
--- a/src/jrummikub/view/impl/LoginPanel.java
+++ b/src/jrummikub/view/impl/LoginPanel.java
@@ -40,25 +40,30 @@ class LoginPanel extends JPanel implements ILoginPanel {
c.weightx = 1;
c.weighty = 1;
+ ActionListener loginAction = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ login();
+ }
+ };
+
userNameField = addInputRow("Benutzername:", new JTextField());
userNameField.setText("test1");
+ userNameField.addActionListener(loginAction);
serverNameField = addInputRow("Server:", new JTextField());
serverNameField.setText("universe-factory.net");
+ serverNameField.addActionListener(loginAction);
passwordField = addInputRow("Passwort:", new JPasswordField());
+ passwordField.addActionListener(loginAction);
channelNameField = addInputRow("Channel:", new JTextField());
channelNameField.setText("jrummikub@muc.universe-factory.net");
+ channelNameField.addActionListener(loginAction);
add(Box.createVerticalGlue(), c);
c.gridwidth = 1;
c.weighty = 0;
JButton loginButton = new JButton("Login");
- loginButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- loginEvent.emit(new LoginData(userNameField.getText(), serverNameField
- .getText(), passwordField.getText(), channelNameField.getText()));
- }
- });
+ loginButton.addActionListener(loginAction);
add(loginButton, c);
c.weightx = 0;
@@ -102,4 +107,9 @@ class LoginPanel extends JPanel implements ILoginPanel {
add(textField, c);
return textField;
}
+
+ private void login() {
+ loginEvent.emit(new LoginData(userNameField.getText(), serverNameField
+ .getText(), passwordField.getText(), channelNameField.getText()));
+ }
}