diff options
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r-- | src/jrummikub/view/impl/LoginPanel.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/jrummikub/view/impl/LoginPanel.java b/src/jrummikub/view/impl/LoginPanel.java index 1ea49da..9fef581 100644 --- a/src/jrummikub/view/impl/LoginPanel.java +++ b/src/jrummikub/view/impl/LoginPanel.java @@ -34,7 +34,7 @@ class LoginPanel extends JPanel implements ILoginPanel { private JTextField passwordField; private JTextField channelNameField; private JButton startDedicatedServerButton; - + LoginPanel() { setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); @@ -44,7 +44,7 @@ class LoginPanel extends JPanel implements ILoginPanel { c.weighty = 1; ActionListener loginAction = createInputFields(); - + c.weighty = 0; add(startDedicatedServerButton, c); startDedicatedServerButton.addActionListener(new ActionListener() { @@ -53,7 +53,7 @@ class LoginPanel extends JPanel implements ILoginPanel { useDedicatedServer.emit(passwordField.getText()); } }); - + c.weighty = 1; add(Box.createVerticalGlue(), c); @@ -77,8 +77,8 @@ class LoginPanel extends JPanel implements ILoginPanel { }); add(cancelButton, c); - setBorder(new CompoundBorder(new LineBorder(Color.BLACK), new EmptyBorder( - 10, 10, 10, 10))); + setBorder(new CompoundBorder(new LineBorder(Color.BLACK), + new EmptyBorder(10, 10, 10, 10))); } private ActionListener createInputFields() { @@ -99,7 +99,7 @@ class LoginPanel extends JPanel implements ILoginPanel { channelNameField.addActionListener(loginAction); startDedicatedServerButton = new JButton("Dedizierten Server starten"); // this fixes some strange layouting bug - startDedicatedServerButton.setPreferredSize(new Dimension(500,10)); + startDedicatedServerButton.setPreferredSize(new Dimension(500, 10)); return loginAction; } @@ -125,7 +125,7 @@ class LoginPanel extends JPanel implements ILoginPanel { public IEvent1<String> getUseDedicatedServerEvent() { return useDedicatedServer; } - + private JTextField addInputRow(String label, JTextField textField) { GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; @@ -144,14 +144,15 @@ class LoginPanel extends JPanel implements ILoginPanel { private void login() { loginEvent.emit(new LoginData(userNameField.getText(), serverNameField - .getText(), passwordField.getText(), channelNameField.getText())); + .getText(), passwordField.getText().isEmpty() ? "jrummikub" + : passwordField.getText(), channelNameField.getText())); } @Override public void setServer(String server) { serverNameField.setText(server); } - + @Override public void setChannel(String channel) { channelNameField.setText(channel); @@ -159,6 +160,8 @@ class LoginPanel extends JPanel implements ILoginPanel { @Override public void setDedicatedServerRunning(boolean running) { - startDedicatedServerButton.setText(running ? "Dedizierten Server nutzen" : "Dedizierten Server starten"); + startDedicatedServerButton + .setText(running ? "Dedizierten Server nutzen" + : "Dedizierten Server starten"); } } |