All Packages Class Hierarchy This Package Previous Next Index
Class life.GridDisplay
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----life.GridDisplay
- public class GridDisplay
- extends Panel
A GridDisplay object displays a Grid
object.
-
backgroundColor
- Background color.
-
cellColor
-
Cell color.
-
cellColors
- Available
Cell colors.
-
cellHeight
- Width and height of
Cells in this GridDisplay.
-
cellWidth
- Width and height of
Cells in this GridDisplay.
-
currX
- X grid coordinate of
Cell over which mouse
was most recently pressed.
-
currY
- Y grid coordinate of
Cell over which mouse
was most recently pressed.
-
DRAWING
- The user is in draw mode.
-
drawMode
- Current drawing mode.
-
ERASING
- The user is in erase mode.
-
gridHeight
- Width and height of this
GridDisplay (in Cells).
-
gridWidth
- Width and height of this
GridDisplay (in Cells).
-
height
- Width and height of this
GridDisplay (in pixels).
-
maxAge
- Maximum
Cell age.
-
offGraphics
- Offscreen graphics context.
-
offImage
- Offscreen drawing Image.
-
paintAll
- Paint all cells in
GridDisplay or only those
which have changed since last generation?
-
parent
- The parent
LifeDisplay of this GridDisplay.
-
shades
- Number of shades.
-
theLife
- The
Life object to be displayed by this
GridDisplay.
-
width
- Width and height of this
GridDisplay (in pixels).
-
GridDisplay(Life, LifeDisplay)
-
Construct a
GridDisplay to display theLife
within LifeDisplay.
-
GridDisplay_MouseDrag(MouseEvent)
- Respond to a mouse drag.
-
GridDisplay_MousePress(MouseEvent)
- Respond to a mouse press.
-
paint(Graphics)
- Default paint() method.
-
paint(Graphics, boolean)
-
Paint with option to paint only the dirty (changed)
Cells
in the GridDisplay.
-
pixelXToGridX(int)
- Convert a pixel X coordinate to a
GridDisplay X coordinate.
-
pixelYToGridY(int)
- Convert a pixel Y coordinate to
GridDisplay Y coordinate.
-
setBackgroundColor(Color)
- Set the current background color.
-
setCellColor(Color)
- Set the current
Cell color.
-
setDrawMode(int)
- Set the current drawing mode.
-
setGridSize()
- Set the size of the grid.
-
setPaintAll(boolean)
- Indicate whether all
Cells in the GridDisplay
should be displayed or only the dirty Cells.
-
setShades(int)
-
Set the current number of shades of colors.
-
update(Graphics)
- Update the
GridDisplay.
DRAWING
static final int DRAWING
- The user is in draw mode.
ERASING
static final int ERASING
- The user is in erase mode.
theLife
Life theLife
- The
Life object to be displayed by this
GridDisplay.
parent
LifeDisplay parent
- The parent
LifeDisplay of this GridDisplay.
width
int width
- Width and height of this
GridDisplay (in pixels).
height
int height
- Width and height of this
GridDisplay (in pixels).
gridWidth
int gridWidth
- Width and height of this
GridDisplay (in Cells).
gridHeight
int gridHeight
- Width and height of this
GridDisplay (in Cells).
cellWidth
int cellWidth
- Width and height of
Cells in this GridDisplay.
cellHeight
int cellHeight
- Width and height of
Cells in this GridDisplay.
drawMode
int drawMode
- Current drawing mode.
maxAge
int maxAge
- Maximum
Cell age.
offImage
Image offImage
- Offscreen drawing Image.
offGraphics
Graphics offGraphics
- Offscreen graphics context.
cellColor
Color cellColor
-
Cell color.
backgroundColor
Color backgroundColor
- Background color.
shades
int shades
- Number of shades.
cellColors
Color cellColors[]
- Available
Cell colors.
currX
int currX
- X grid coordinate of
Cell over which mouse
was most recently pressed.
currY
int currY
- Y grid coordinate of
Cell over which mouse
was most recently pressed.
paintAll
boolean paintAll
- Paint all cells in
GridDisplay or only those
which have changed since last generation?
GridDisplay
GridDisplay(Life theLife,
LifeDisplay parent)
- Construct a
GridDisplay to display theLife
within LifeDisplay.
- Parameters:
- theLife - The Life object to display.
- parent - The parent
LifeDisplay of this
GridDisplay.
setGridSize
synchronized void setGridSize()
- Set the size of the grid.
setDrawMode
void setDrawMode(int drawMode)
- Set the current drawing mode.
- Parameters:
- drawMode - The drawing mode to set (drawing or erasing).
setCellColor
synchronized void setCellColor(Color c)
- Set the current
Cell color.
- Parameters:
- c - The color to use.
setBackgroundColor
synchronized void setBackgroundColor(Color c)
- Set the current background color.
- Parameters:
- c - The color to use.
setShades
synchronized void setShades(int s)
- Set the current number of shades of colors.
- Parameters:
- s - The number of shades.
setPaintAll
void setPaintAll(boolean paintAll)
- Indicate whether all
Cells in the GridDisplay
should be displayed or only the dirty Cells.
- Parameters:
- paintAll - True if all
Cells should be displayed,
false otherwise.
paint
public void paint(Graphics g)
- Default paint() method.
- Parameters:
- g - The graphics context.
- Overrides:
- paint in class Container
paint
public void paint(Graphics g,
boolean paintAll)
- Paint with option to paint only the dirty (changed)
Cells
in the GridDisplay.
- Parameters:
- g - The graphics context in which to paint.
- paintall - True if all
Cells should be painted,
false otherwise.
update
public void update(Graphics g)
- Update the
GridDisplay.
- Parameters:
- g - The graphics context to use.
- Overrides:
- update in class Container
GridDisplay_MousePress
void GridDisplay_MousePress(MouseEvent event)
- Respond to a mouse press.
GridDisplay_MouseDrag
void GridDisplay_MouseDrag(MouseEvent event)
- Respond to a mouse drag.
pixelXToGridX
int pixelXToGridX(int pixelX)
- Convert a pixel X coordinate to a
GridDisplay X coordinate.
- Parameters:
- pixelX - The pixel X coordinate.
pixelYToGridY
int pixelYToGridY(int pixelY)
- Convert a pixel Y coordinate to
GridDisplay Y coordinate.
- Parameters:
- pixelY - The pixel Y coordinate.
All Packages Class Hierarchy This Package Previous Next Index