From 79ae31b1c75e5f33760c500a08a504a195c565f8 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Wed, 22 Jun 2011 02:00:04 +0200 Subject: Fix in LoginPanel git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@568 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/impl/LoginPanel.java | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src') 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 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"); } } -- cgit v1.2.3