Game of Life 1.5

org.bitstorm.gameoflife
Class GameOfLifeControlsEvent

java.lang.Object
  extended byjava.awt.Event
      extended byorg.bitstorm.gameoflife.GameOfLifeControlsEvent
All Implemented Interfaces:
java.io.Serializable

public class GameOfLifeControlsEvent
extends java.awt.Event

Event class for GameOfLifeControls. Can pass speed, cellSize and shapeName. Objects from this class are generated by GameOfLifeControls

Author:
Edwin Martin
See Also:
GameOfLifeControls, Serialized Form

Field Summary
private  java.lang.String shapeName
           
private  int speed
           
private  int zoom
           
 
Fields inherited from class java.awt.Event
ACTION_EVENT, ALT_MASK, arg, BACK_SPACE, CAPS_LOCK, clickCount, CTRL_MASK, DELETE, DOWN, END, ENTER, ESCAPE, evt, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, GOT_FOCUS, HOME, id, INSERT, key, KEY_ACTION, KEY_ACTION_RELEASE, KEY_PRESS, KEY_RELEASE, LEFT, LIST_DESELECT, LIST_SELECT, LOAD_FILE, LOST_FOCUS, META_MASK, modifiers, MOUSE_DOWN, MOUSE_DRAG, MOUSE_ENTER, MOUSE_EXIT, MOUSE_MOVE, MOUSE_UP, NUM_LOCK, PAUSE, PGDN, PGUP, PRINT_SCREEN, RIGHT, SAVE_FILE, SCROLL_ABSOLUTE, SCROLL_BEGIN, SCROLL_END, SCROLL_LINE_DOWN, SCROLL_LINE_UP, SCROLL_LOCK, SCROLL_PAGE_DOWN, SCROLL_PAGE_UP, SHIFT_MASK, TAB, target, UP, when, WINDOW_DEICONIFY, WINDOW_DESTROY, WINDOW_EXPOSE, WINDOW_ICONIFY, WINDOW_MOVED, x, y
 
Constructor Summary
GameOfLifeControlsEvent(java.lang.Object source)
          Construct a GameOfLifeControls.ControlsEvent
 
Method Summary
 java.lang.String getShapeName()
          Gets name of shape
static GameOfLifeControlsEvent getShapeSelectedEvent(java.lang.Object source, java.lang.String shapeName)
          Constructs a event due to the shape changed.
 int getSpeed()
          Gets speed of Game
static GameOfLifeControlsEvent getSpeedChangedEvent(java.lang.Object source, int speed)
          Constructs a event due to the speed changed.
 int getZoom()
          Gets size of cell
static GameOfLifeControlsEvent getZoomChangedEvent(java.lang.Object source, int zoom)
          Constructs a event due to the zoom changed.
 void setShapeName(java.lang.String shapeName)
          Sets name of shape
 void setSpeed(int speed)
          Sets speed of Game
 void setZoom(int zoom)
          Sets zoom of Game
 
Methods inherited from class java.awt.Event
controlDown, metaDown, paramString, shiftDown, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

speed

private int speed

zoom

private int zoom

shapeName

private java.lang.String shapeName
Constructor Detail

GameOfLifeControlsEvent

public GameOfLifeControlsEvent(java.lang.Object source)
Construct a GameOfLifeControls.ControlsEvent

Parameters:
source - source of event
Method Detail

getSpeedChangedEvent

public static GameOfLifeControlsEvent getSpeedChangedEvent(java.lang.Object source,
                                                           int speed)
Constructs a event due to the speed changed.

Parameters:
source - source of the event
speed - new speed
Returns:
new event object

getZoomChangedEvent

public static GameOfLifeControlsEvent getZoomChangedEvent(java.lang.Object source,
                                                          int zoom)
Constructs a event due to the zoom changed.

Parameters:
source - source of the event
zoom - new zoom (cell size in pixels)
Returns:
new event object

getShapeSelectedEvent

public static GameOfLifeControlsEvent getShapeSelectedEvent(java.lang.Object source,
                                                            java.lang.String shapeName)
Constructs a event due to the shape changed.

Parameters:
source - source of the event
shapeName - name of selected shape
Returns:
new event object

getSpeed

public int getSpeed()
Gets speed of Game

Returns:
speed (10 is fast, 1000 is slow)

setSpeed

public void setSpeed(int speed)
Sets speed of Game

Parameters:
speed - (10 is fast, 1000 is slow)

getZoom

public int getZoom()
Gets size of cell

Returns:
speed (10 is big, 2 is small)

setZoom

public void setZoom(int zoom)
Sets zoom of Game

Parameters:
zoom - size of cell in pixels

getShapeName

public java.lang.String getShapeName()
Gets name of shape

Returns:
name of selected shape

setShapeName

public void setShapeName(java.lang.String shapeName)
Sets name of shape

Parameters:
shapeName - name of shape

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>.