org.vizzini.ui.game
Class AbstractGameUISwing

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by org.vizzini.ui.AbstractApp
                          extended by org.vizzini.ui.game.AbstractGameUISwing
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, IConcedeListener, IGameListener, IStateListener, IGameUI, IOSXApp, IBusyListener, IListener
Direct Known Subclasses:
AbstractArcadeGameUISwing, AbstractBoardgameUISwing, AbstractCardGameUISwing, AbstractSimulationUISwing

public abstract class AbstractGameUISwing
extends AbstractApp
implements IGameUI

Provides base functionality for Swing game user interfaces in the game framework.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AbstractGameUISwing()
          Construct this object.
 
Method Summary
protected  void assignAgentListener(IAgent agent)
          Assign listeners to the given agent.
 void assignAgentListeners(Iterator agentIterator)
          Assign listeners using the given agents.
 void audioActionPerformed(ActionEvent event)
          Callback for the audio action.
 void busy(BusyEvent event)
          Respond to busy events.
protected  void checkActions()
          Check the action enabled states.
protected  boolean checkForFileOverwrite(File file)
          Return true if it's OK to overwrite the given file.
 void concede(ConcedeEvent event)
          Respond to concede events.
 void concedeActionPerformed(ActionEvent event)
          Callback for the concede action.
protected  StatusBar createStatusBar()
          Create the status bar.
protected  void fillAdditionalEditMenuItems(JMenu fileMenu)
          Fill in additional edit menu items.
protected  void fillAdditionalFileMenuItems(JMenu fileMenu)
          Fill in additional file menu items.
protected  void fillAdditionalHelpMenuItems(JMenu helpMenu)
          Fill in additional help menu items.
protected  void fillAdditionalMenus(JMenuBar menuBar, Container container)
          Fill in additional menus.
protected  void fillAdditionalOptionsMenuItems(JMenu optionsMenu)
          Fill in additional options menu items.
protected  void fillAdditionalViewMenuItems(JMenu viewMenu)
          Fill in additional view menu items.
protected  void fillMenuBar()
          Create the menu bar.
protected  void fillToolBar()
          Fill the tool bar.
 void gameChange(GameEvent event)
          Respond to game events.
 IEnvironmentUI getEnvironmentUI()
          Return the environment user interface component.
protected  JFileChooser getFileChooser()
          Return the file chooser, creating it if necessary.
 IGame getGame()
          Return the game component.
protected  GameUISupport getGameUISupport()
          Return the game UI support object.
protected  Properties getProperties()
          Return the configuration properties.
protected  StatusManager getStatusManager()
          Return the status manager.
 void init()
          Initialize this applet.
 boolean isAudioOn()
          Return true if audio is on.
protected  boolean isConcedeAvailable()
          Return true if the Concede action is available.
 void newActionPerformed(ActionEvent event)
          Callback for the new action.
 void openActionPerformed(ActionEvent event)
          Callback for the open action.
protected  void removeAgentListener(IAgent agent)
          Remove listeners using the given agent.
 void removeAgentListeners(Iterator agentIterator)
          Remove listeners using the given agents.
 void saveActionPerformed(ActionEvent event)
          Callback for the save action.
 void saveAsActionPerformed(ActionEvent event)
          Callback for the save as action.
 void setAudioOn(boolean isAudioOn)
          Set the audio on flag.
 void showStatusBarActionPerformed(ActionEvent event)
          Callback for the show status bar action.
 void showToolBarActionPerformed(ActionEvent event)
          Perform the show tool bar action.
 void start()
          Start this applet.
 void stateChange(StateEvent event)
          Respond to state events.
 void stop()
          Stop this applet.
 boolean useToolBar()
          Return true if a tool bar is desired.
 
Methods inherited from class org.vizzini.ui.AbstractApp
aboutActionPerformed, cleanup, doMain, getAppName, getFrame, getInitialDimension, getMenuBar, getMenuBarContainer, macOSXRegistration, onlineHelpActionPerformed, preferencesActionPerformed, quitActionPerformed, setCursorBusy, usePreferencesMenu, useSplashScreen
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractGameUISwing

public AbstractGameUISwing()
Construct this object.

Since:
v0.1
Method Detail

assignAgentListeners

public void assignAgentListeners(Iterator agentIterator)
Assign listeners using the given agents.

Parameters:
agentIterator - Agent iterator.
Since:
v0.1

audioActionPerformed

public void audioActionPerformed(ActionEvent event)
Callback for the audio action.

Parameters:
event - Action event.
Since:
v0.1

busy

public void busy(BusyEvent event)
Respond to busy events.

Specified by:
busy in interface IBusyListener
Parameters:
event - Busy event.
Since:
v0.1

concede

public void concede(ConcedeEvent event)
Respond to concede events.

Specified by:
concede in interface IConcedeListener
Parameters:
event - Concede event.
Since:
v0.1

concedeActionPerformed

public void concedeActionPerformed(ActionEvent event)
Callback for the concede action.

Since:
v0.1

gameChange

public void gameChange(GameEvent event)
Respond to game events.

Specified by:
gameChange in interface IGameListener
Parameters:
event - Game event.
Since:
v0.1

getEnvironmentUI

public IEnvironmentUI getEnvironmentUI()
Return the environment user interface component.

Specified by:
getEnvironmentUI in interface IGameUI
Since:
v0.1

getGame

public IGame getGame()
Return the game component.

Specified by:
getGame in interface IGameUI
Since:
v0.1

init

public void init()
Initialize this applet.

Specified by:
init in interface IGameUI
Overrides:
init in class AbstractApp
Since:
v0.1

isAudioOn

public boolean isAudioOn()
Return true if audio is on.

Since:
v0.1

newActionPerformed

public void newActionPerformed(ActionEvent event)
Callback for the new action.

Since:
v0.1

openActionPerformed

public void openActionPerformed(ActionEvent event)
Callback for the open action.

Parameters:
event - Action event.
Since:
v0.1

removeAgentListeners

public void removeAgentListeners(Iterator agentIterator)
Remove listeners using the given agents.

Parameters:
agentIterator - Agent iterator.
Since:
v0.1

saveActionPerformed

public void saveActionPerformed(ActionEvent event)
Callback for the save action.

Parameters:
event - Action event.
Since:
v0.1

saveAsActionPerformed

public void saveAsActionPerformed(ActionEvent event)
Callback for the save as action.

Parameters:
event - Action event.
Since:
v0.1

setAudioOn

public void setAudioOn(boolean isAudioOn)
Set the audio on flag.

Since:
v0.1

showStatusBarActionPerformed

public void showStatusBarActionPerformed(ActionEvent event)
Callback for the show status bar action.

Parameters:
event - Action event.
Since:
v0.1

showToolBarActionPerformed

public void showToolBarActionPerformed(ActionEvent event)
Perform the show tool bar action.

Parameters:
event - Action event.
Since:
v0.01

start

public void start()
Start this applet.

Specified by:
start in interface IGameUI
Overrides:
start in class Applet
Since:
v0.1

stateChange

public void stateChange(StateEvent event)
Respond to state events.

Specified by:
stateChange in interface IStateListener
Since:
v0.2

stop

public void stop()
Stop this applet.

Overrides:
stop in class Applet
Since:
v0.1

useToolBar

public boolean useToolBar()
Return true if a tool bar is desired.

Since:
v0.1

assignAgentListener

protected void assignAgentListener(IAgent agent)
Assign listeners to the given agent.

Parameters:
agent - Agent.
Since:
v0.1

checkActions

protected void checkActions()
Check the action enabled states.

Overrides:
checkActions in class AbstractApp
Since:
v0.3

checkForFileOverwrite

protected boolean checkForFileOverwrite(File file)
Return true if it's OK to overwrite the given file.

Since:
v0.1

createStatusBar

protected StatusBar createStatusBar()
Create the status bar.

Since:
v0.1

fillAdditionalEditMenuItems

protected void fillAdditionalEditMenuItems(JMenu fileMenu)
Fill in additional edit menu items. These menu items are placed at the end of the edit menu..

Parameters:
fileMenu - File menu.
Since:
v0.1

fillAdditionalFileMenuItems

protected void fillAdditionalFileMenuItems(JMenu fileMenu)
Fill in additional file menu items. These menu items are placed between the New and Quit menu items.

Parameters:
fileMenu - File menu.
Since:
v0.1

fillAdditionalHelpMenuItems

protected void fillAdditionalHelpMenuItems(JMenu helpMenu)
Fill in additional help menu items. These menu items are placed above the About menu item.

Parameters:
helpMenu - Help menu.
Since:
v0.1

fillAdditionalMenus

protected void fillAdditionalMenus(JMenuBar menuBar,
                                   Container container)
Fill in additional menus. These menus are placed between the View and Help menus.

Parameters:
menuBar - Menu bar.
container - Menu bar container.
Since:
v0.1

fillAdditionalOptionsMenuItems

protected void fillAdditionalOptionsMenuItems(JMenu optionsMenu)
Fill in additional options menu items. These menu items are placed at the end of the menu.

Parameters:
optionsMenu - Options menu.
Since:
v0.1

fillAdditionalViewMenuItems

protected void fillAdditionalViewMenuItems(JMenu viewMenu)
Fill in additional view menu items. These menu items are placed below the Show Status Bar menu item.

Parameters:
viewMenu - View menu.
Since:
v0.1

fillMenuBar

protected void fillMenuBar()
Create the menu bar.

Since:
v0.1

fillToolBar

protected void fillToolBar()
Fill the tool bar.

Since:
v0.1

getFileChooser

protected JFileChooser getFileChooser()
Return the file chooser, creating it if necessary.

Since:
v0.1

getGameUISupport

protected GameUISupport getGameUISupport()
Return the game UI support object.

Since:
v0.1

getProperties

protected Properties getProperties()
Return the configuration properties.

Since:
v0.1

getStatusManager

protected StatusManager getStatusManager()
Return the status manager.

Since:
v0.1

isConcedeAvailable

protected boolean isConcedeAvailable()
Return true if the Concede action is available.

Since:
v0.3

removeAgentListener

protected void removeAgentListener(IAgent agent)
Remove listeners using the given agent.

Parameters:
agent - Agent.
Since:
v0.1


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02