diff options
Diffstat (limited to 'src/jrummikub/view/impl')
-rw-r--r-- | src/jrummikub/view/impl/ConnectPanel.java | 11 | ||||
-rw-r--r-- | src/jrummikub/view/impl/QuitWarningPanel.java | 14 | ||||
-rw-r--r-- | src/jrummikub/view/impl/View.java | 25 |
3 files changed, 33 insertions, 17 deletions
diff --git a/src/jrummikub/view/impl/ConnectPanel.java b/src/jrummikub/view/impl/ConnectPanel.java index befa687..fc30bb0 100644 --- a/src/jrummikub/view/impl/ConnectPanel.java +++ b/src/jrummikub/view/impl/ConnectPanel.java @@ -21,13 +21,20 @@ import jrummikub.util.IEvent; import jrummikub.view.IConnectPanel;
import jrummikub.view.LoginError;
+/**
+ * Panel shown during network connecting process and showing errors
+ */
public class ConnectPanel extends JPanel implements IConnectPanel {
+ private static final long serialVersionUID = 1L;
private JLabel messageLabel;
private JProgressBar foobar;
private JButton cancelButton;
private Event cancelEvent = new Event();
+ /**
+ * Creates new connection panel
+ */
public ConnectPanel() {
setLayout(new GridBagLayout());
@@ -61,8 +68,8 @@ public class ConnectPanel extends JPanel implements IConnectPanel { });
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)));
}
@Override
diff --git a/src/jrummikub/view/impl/QuitWarningPanel.java b/src/jrummikub/view/impl/QuitWarningPanel.java index edc8947..f00ef8a 100644 --- a/src/jrummikub/view/impl/QuitWarningPanel.java +++ b/src/jrummikub/view/impl/QuitWarningPanel.java @@ -18,7 +18,11 @@ import jrummikub.util.Event; import jrummikub.util.IEvent; import jrummikub.view.IQuitWarningPanel; +/** + * Warning panel to inform users if their actions would end the current game + */ public class QuitWarningPanel extends JPanel implements IQuitWarningPanel { + private static final long serialVersionUID = 1L; private JButton cancelButton; private JButton quitButton; private QuitMode quitMode; @@ -26,6 +30,9 @@ public class QuitWarningPanel extends JPanel implements IQuitWarningPanel { private Event cancelEvent = new Event(); private JLabel messageLabel; + /** + * Creates new quit warning panel + */ public QuitWarningPanel() { setLayout(new GridBagLayout()); @@ -50,8 +57,8 @@ public class QuitWarningPanel extends JPanel implements IQuitWarningPanel { c.gridx = 1; add(quitButton, 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 JButton createButton(String title, final Event event) { @@ -70,7 +77,8 @@ public class QuitWarningPanel extends JPanel implements IQuitWarningPanel { this.quitMode = mode; switch (quitMode) { case QUIT_PROCESS: - messageLabel.setText("Beim Beenden geht das aktuelle Spiel verloren"); + messageLabel + .setText("Beim Beenden geht das aktuelle Spiel verloren"); break; case QUIT_GAME: messageLabel.setText("Der aktuelle Spielstand geht verloren"); diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index 94cb04f..5cc1a85 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -14,7 +14,6 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import javax.swing.JComponent; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLayeredPane; @@ -43,7 +42,6 @@ import jrummikub.view.IHandPanel; import jrummikub.view.ILoginPanel; import jrummikub.view.IPlayerPanel; import jrummikub.view.IQuitWarningPanel; -import jrummikub.view.IQuitWarningPanel.QuitMode; import jrummikub.view.IScorePanel; import jrummikub.view.ISettingsPanel; import jrummikub.view.ISidePanel; @@ -232,7 +230,6 @@ public class View extends JFrame implements IView { loadItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - File file = new File(""); loadEvent.emit(); } }); @@ -314,6 +311,19 @@ public class View extends JFrame implements IView { createSettingsPanel(); + createLayeredPane(); + + addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent e) { + rescale(); + } + }); + + setVisible(true); + } + + private void createLayeredPane() { layeredPane.setLayer(settingsPanel, JLayeredPane.POPUP_LAYER); layeredPane.add(settingsPanel); @@ -341,15 +351,6 @@ public class View extends JFrame implements IView { scorePanel.setVisible(false); layeredPane.setLayer(scorePanel, JLayeredPane.POPUP_LAYER); layeredPane.add(scorePanel); - - addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(ComponentEvent e) { - rescale(); - } - }); - - setVisible(true); } private void createSettingsPanel() { |