|
Game of Life 1.5 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
org.bitstorm.gameoflife.GameOfLife
The Game Of Life Applet. This is the heart of the program. It initializes everything en put it together.
| Nested Class Summary |
| 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 | |
protected int |
cellCols
|
protected int |
cellRows
|
protected int |
cellSize
|
protected GameOfLifeControls |
controls
|
protected CellGridCanvas |
gameOfLifeCanvas
|
protected GameOfLifeGrid |
gameOfLifeGrid
|
protected static java.lang.Thread |
gameThread
|
protected int |
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 | |
GameOfLife()
|
|
| Method Summary | |
void |
alert(java.lang.String s)
Shows an alert |
java.lang.String |
getAppletInfo()
|
int |
getCellSize()
Gets cell size. |
protected int |
getParamInteger(java.lang.String name,
int defaultParam)
Read applet parameter (int) or, when unavailable, get default value. |
protected void |
getParams()
Get params (cellSize, cellCols, cellRows, genTime) from applet-tag |
void |
init()
Initialize UI. |
boolean |
isRunning()
Is the applet running? |
void |
nextButtonClicked(GameOfLifeControlsEvent e)
Callback from GameOfLifeControlsListener |
void |
nextGeneration()
Go to the next generation. |
void |
reset()
Resets applet (after loading new shape) |
void |
run()
|
void |
setCellSize(int p)
Sets cell size. |
void |
setShape(Shape shape)
Set the new shape |
void |
setSpeed(int fps)
Set speed of new generations. |
void |
shapeSelected(GameOfLifeControlsEvent e)
Callback from GameOfLifeControlsListener |
private void |
showGenerations()
Show number of generations. |
void |
speedChanged(GameOfLifeControlsEvent e)
Callback from GameOfLifeControlsListener |
void |
start2()
Starts creating new generations. |
void |
startStopButtonClicked(GameOfLifeControlsEvent e)
Callback from GameOfLifeControlsListener |
void |
stop()
|
void |
zoomChanged(GameOfLifeControlsEvent e)
Callback from GameOfLifeControlsListener |
| Methods inherited from class java.applet.Applet |
destroy, getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, 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 |
protected CellGridCanvas gameOfLifeCanvas
protected GameOfLifeGrid gameOfLifeGrid
protected int cellSize
protected int cellCols
protected int cellRows
protected int genTime
protected GameOfLifeControls controls
protected static java.lang.Thread gameThread
| Constructor Detail |
public GameOfLife()
| Method Detail |
public void init()
Applet.init()protected void getParams()
protected int getParamInteger(java.lang.String name,
int defaultParam)
name - name of parameterdefaultParam - default when parameter is unavailable
public void start2()
public void stop()
Applet.stop()public void run()
run in interface java.lang.RunnableRunnable.run()public boolean isRunning()
public void nextGeneration()
public void setShape(Shape shape)
shape - name of shapepublic void reset()
public java.lang.String getAppletInfo()
Applet.getAppletInfo()private void showGenerations()
public void setSpeed(int fps)
fps - generations per secondpublic void setCellSize(int p)
p - size of cell in pixelspublic int getCellSize()
public void alert(java.lang.String s)
s - text to showpublic void startStopButtonClicked(GameOfLifeControlsEvent e)
startStopButtonClicked in interface GameOfLifeControlsListenere - event objectGameOfLifeControlsListener.startStopButtonClicked(org.bitstorm.gameoflife.GameOfLifeControlsEvent)public void nextButtonClicked(GameOfLifeControlsEvent e)
nextButtonClicked in interface GameOfLifeControlsListenere - event objectGameOfLifeControlsListener.nextButtonClicked(org.bitstorm.gameoflife.GameOfLifeControlsEvent)public void speedChanged(GameOfLifeControlsEvent e)
speedChanged in interface GameOfLifeControlsListenere - event objectGameOfLifeControlsListener.speedChanged(org.bitstorm.gameoflife.GameOfLifeControlsEvent)public void zoomChanged(GameOfLifeControlsEvent e)
zoomChanged in interface GameOfLifeControlsListenere - event objectGameOfLifeControlsListener.speedChanged(org.bitstorm.gameoflife.GameOfLifeControlsEvent)public void shapeSelected(GameOfLifeControlsEvent e)
shapeSelected in interface GameOfLifeControlsListenere - event objectGameOfLifeControlsListener.shapeSelected(org.bitstorm.gameoflife.GameOfLifeControlsEvent)
|
Game of Life 1.5 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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>.