Game of Life 1.5

org.bitstorm.gameoflife
Class StandaloneGameOfLife

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byorg.bitstorm.gameoflife.GameOfLife
                      extended byorg.bitstorm.gameoflife.StandaloneGameOfLife
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, GameOfLifeControlsListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class StandaloneGameOfLife
extends GameOfLife

Turns GameOfLife applet into application. It adds a menu, a window, drag-n-drop etc. It can be run stand alone.

Author:
Edwin Martin
See Also:
Serialized Form

Nested Class Summary
(package private)  class StandaloneGameOfLife.GameOfLifeGridIO
          File open and save operations for GameOfLifeGrid.
(package private)  class StandaloneGameOfLife.MyDropListener
          Handles drag and drops to the canvas.
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.awt.Frame appletFrame
           
private  java.lang.String[] args
           
private  StandaloneGameOfLife.GameOfLifeGridIO gridIO
           
 
Fields inherited from class org.bitstorm.gameoflife.GameOfLife
cellCols, cellRows, cellSize, controls, gameOfLifeCanvas, gameOfLifeGrid, gameThread, genTime
 
Fields inherited from class java.applet.Applet
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
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
StandaloneGameOfLife()
           
 
Method Summary
 void alert(java.lang.String s)
          Shows an alert
protected  StandaloneGameOfLife.GameOfLifeGridIO getGameOfLifeGridIO()
          get GameOfLifeGridIO
 java.lang.String getParameter(java.lang.String parm)
          Override method, called by applet.
 void init(java.awt.Frame parent)
          Initialize UI.
static void main(java.lang.String[] args)
          main() for standalone version.
 void readShape()
          Set the shape.
 void showStatus(java.lang.String s)
          Do not use showStatus() of the applet.
 
Methods inherited from class org.bitstorm.gameoflife.GameOfLife
getAppletInfo, getCellSize, getParamInteger, getParams, init, isRunning, nextButtonClicked, nextGeneration, reset, run, setCellSize, setShape, setSpeed, shapeSelected, speedChanged, start2, startStopButtonClicked, stop, zoomChanged
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, start
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, 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, 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, isOpaque, 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, setName, 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
 

Field Detail

appletFrame

private java.awt.Frame appletFrame

args

private java.lang.String[] args

gridIO

private StandaloneGameOfLife.GameOfLifeGridIO gridIO
Constructor Detail

StandaloneGameOfLife

public StandaloneGameOfLife()
Method Detail

main

public static void main(java.lang.String[] args)
main() for standalone version.

Parameters:
args - Not used.

init

public void init(java.awt.Frame parent)
Initialize UI.

Parameters:
parent - Parent frame.
See Also:
Applet.init()

readShape

public void readShape()
Set the shape. This is not done in init(), because the window resize in GameOfLifeGridIO.setShape(Shape) needs a fully opened window to do new size calculations.


getParameter

public java.lang.String getParameter(java.lang.String parm)
Override method, called by applet.

See Also:
Applet.getParameter(java.lang.String)

alert

public void alert(java.lang.String s)
Shows an alert

Overrides:
alert in class GameOfLife
Parameters:
s - text to show

showStatus

public void showStatus(java.lang.String s)
Do not use showStatus() of the applet.

See Also:
Applet.showStatus(java.lang.String)

getGameOfLifeGridIO

protected StandaloneGameOfLife.GameOfLifeGridIO getGameOfLifeGridIO()
get GameOfLifeGridIO

Returns:
GameOfLifeGridIO object

Game of Life 1.5

This API descibes the Game of Life program, written by Edwin Martin. The source code is available online too.

Copyright 1996-2004 Edwin Martin <edwin@bitstorm.org>.