1 package net.sourceforge.simplegamenet.specs.gui;
2
3 import javax.swing.*;
4
5 /***
6 * An abstract superclass and panel which is the visual representation of a {@link
7 * net.sourceforge.simplegamenet.specs.to.GameSettings} object. This panel is used in the connection
8 * wizard for hosting a game and in the "Game settings" tab for every user. In the "Game Settings"
9 * tab it is only enabled for the host. The SimpleGameNet framework creates this panel with {@link
10 * net.sourceforge.simplegamenet.specs.to.GameSettings#createGameSettingsPanel()}.
11 * <p/>
12 * If a game setting is editable, it should be represented in this panel as an editable component.
13 * If a host changes this game settings panel, it is supplied as an argument to {@link
14 * GameSettings#createChangedGameSettings(GameSettingsPanel)} to create changed game settings. If a
15 * game setting shouldn't be visible, it shouldn't be represented in this panel.
16 * <p/>
17 * This game settings panel should not have a direct reference to the game settings.
18 *
19 * @author Geoffrey De Smet
20 * @version 1.0, 2003-06-18
21 * @see net.sourceforge.simplegamenet.specs.to.GameSettings
22 */
23 abstract public class GameSettingsPanel extends JPanel {
24
25 /***
26 * Returns <code>true</code> if the edited game settings are valid according to game settings
27 * rules for a possible game state. This method can inform the host why the game settings are
28 * invalid with a <code>Dialog</code> or <code>JOptionPane</code>.
29 * <p/>
30 * This method should not try to check if the edited game settings are acceptable with the
31 * current game state, {@link net.sourceforge.simplegamenet.specs.to.GameSettings#isChangeGameSettingsAllowed(net.sourceforge.simplegamenet.specs.to.GameSettings)}
32 * does that. The method can for example check if a text field isn't empty.
33 *
34 * @return <code>true</code> if the edited game settings are valid
35 */
36 public boolean areSettingsAcceptable() {
37 return true;
38 }
39
40 public void setEnabled(boolean enabled) {
41 super.setEnabled(enabled);
42 }
43
44 }