|
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.Canvas
org.bitstorm.gameoflife.CellGridCanvas
Subclass of Canvas, which makes the cellgrid visible. Communicates via CellGrid interface.
| Nested Class Summary |
| Nested classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
private CellGrid |
cellGrid
|
private int |
cellSize
|
private boolean |
cellUnderMouse
|
private java.util.Vector |
listeners
|
private int |
newCellSize
|
private Shape |
newShape
|
private java.awt.Graphics |
offScreenGraphics
|
private java.awt.Graphics |
offScreenGraphicsDrawed
Image, containing the drawed grid. |
private java.awt.Image |
offScreenImage
Image for double buffering, to prevent flickering. |
private java.awt.Image |
offScreenImageDrawed
|
| Fields inherited from class java.awt.Canvas |
|
| 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 | |
CellGridCanvas(CellGrid cellGrid,
int cellSize)
Constructs a CellGridCanvas. |
|
| Method Summary | |
void |
draw(int x,
int y)
Draw in this cell. |
java.awt.Dimension |
getMinimumSize()
This is the minimum size (size of one cell). |
java.awt.Dimension |
getPreferredSize()
This is the preferred size. |
void |
paint(java.awt.Graphics g)
Draw this generation. |
void |
resized()
The grid is resized (by window resize or zooming). |
void |
saveCellUnderMouse(int x,
int y)
Remember state of cell for drawing. |
void |
setAfterWindowResize(Shape newShape,
int newCellSize)
Settings to appy after a window-resize. |
void |
setCellSize(int cellSize)
Set cell size (zoom factor) |
void |
setShape(Shape shape)
Draws shape in grid. |
void |
update(java.awt.Graphics g)
Use double buffering. |
| Methods inherited from class java.awt.Canvas |
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private boolean cellUnderMouse
private java.awt.Image offScreenImage
private java.awt.Graphics offScreenGraphics
private java.awt.Image offScreenImageDrawed
private java.awt.Graphics offScreenGraphicsDrawed
private int cellSize
private CellGrid cellGrid
private java.util.Vector listeners
private int newCellSize
private Shape newShape
| Constructor Detail |
public CellGridCanvas(CellGrid cellGrid,
int cellSize)
cellGrid - the GoL cellgridcellSize - size of cell in pixels| Method Detail |
public void setCellSize(int cellSize)
cellSize - Size of cell in pixelspublic void resized()
public void saveCellUnderMouse(int x,
int y)
x - x-coordinatey - y-coordinate
public void draw(int x,
int y)
x - x-coordinatey - y-coordinatepublic void update(java.awt.Graphics g)
Component.update(java.awt.Graphics)public void paint(java.awt.Graphics g)
Component.paint(java.awt.Graphics)public java.awt.Dimension getPreferredSize()
Component.getPreferredSize()public java.awt.Dimension getMinimumSize()
Component.getMinimumSize()
public void setAfterWindowResize(Shape newShape,
int newCellSize)
newShape - new shapenewCellSize - new cellSize
public void setShape(Shape shape)
throws ShapeException
shape - name of shape
ShapeException - if the shape does not fit on the canvas
|
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>.