From 9c553786f2e0e395149a5ef5e27d24d7d944fe3e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 10 Jun 2011 20:20:05 +0200 Subject: Reset settings panel selected tab git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@405 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/impl/SettingsPanel.java | 7 ++++++- src/jrummikub/view/impl/View.java | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/jrummikub/view/impl') diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index 740cfc8..d7d9069 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -60,6 +60,7 @@ import jrummikub.view.ISettingsPanel; @SuppressWarnings("serial") class SettingsPanel extends JPanel implements ISettingsPanel { + private JTabbedPane tabbedPane; private JPanel playerSetupPanel; private JPanel playerSettingsViewport; private JPanel optionsPanel; @@ -422,7 +423,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { SettingsPanel() { setLayout(new GridBagLayout()); - final JTabbedPane tabbedPane = new JTabbedPane(); + tabbedPane = new JTabbedPane(); createPlayerSetupPanel(); tabbedPane.addTab("Spieler", playerSetupPanel); @@ -461,6 +462,10 @@ class SettingsPanel extends JPanel implements ISettingsPanel { 10, 10, 10, 10))); } + void resetTabbedPane() { + tabbedPane.setSelectedIndex(0); + } + private JButton addButton(String title, final Event event, GridBagConstraints c) { JButton button = new JButton(title); diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index 8ef8e50..99e8924 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -350,6 +350,10 @@ public class View extends JFrame implements IView { @Override public void showSettingsPanel(boolean show) { + if (show) { + settingsPanel.resetTabbedPane(); + } + settingsPanel.setVisible(show); } -- cgit v1.2.3