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.PlayerSettings} object. This panel is used in the "Player 8 * Settings" panel in the "Chat" tab only with the player whose player settings it represent. The 9 * SimpleGameNet framework creates this panel with {@link PlayerSettings#createPlayerSettingsPanel()}. 10 * <p/> 11 * If a player setting is editable, it should be represented in this panel as an editable component. 12 * If a player changes this player settings panel, it is supplied as an argument to {@link 13 * PlayerSettings#createChangedPlayerSettings(PlayerSettingsPanel)} to create changed player 14 * settings. If a player setting shouldn't be visible, it shouldn't be represented in this panel. 15 * <p/> 16 * This player settings panel should not have a direct reference to the player settings. 17 * 18 * @author Geoffrey De Smet 19 * @version 1.0, 2003-06-18 20 * @see net.sourceforge.simplegamenet.specs.to.GameSettings 21 */ 22 abstract public class PlayerSettingsPanel extends JPanel { 23 24 /*** 25 * Returns <code>true</code> if the edited player settings are valid according to player 26 * settings rules for a possible game state. This method can inform the player why the player 27 * settings are invalid with a <code>Dialog</code> or <code>JOptionPane</code>. 28 * <p/> 29 * This method should not try to check if the edited player settings are acceptable with the 30 * current game state, {@link net.sourceforge.simplegamenet.specs.to.PlayerSettings#isChangePlayerSettingsAllowed(net.sourceforge.simplegamenet.specs.to.PlayerSettings)} 31 * does that. The method can for example check if a text field isn't empty. 32 * 33 * @return <code>true</code> if the edited player settings are valid 34 */ 35 public boolean areSettingsAcceptable() { 36 return true; 37 } 38 39 public void setEnabled(boolean enabled) { 40 super.setEnabled(enabled); 41 } 42 43 }