All Packages Class Hierarchy This Package Previous Next Index
Class gpsys.lawnmower.LawnViewer
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----gpsys.lawnmower.LawnViewer
- public class LawnViewer
- extends Canvas
- implements LawnObserver
Provides a view of the lawn and lawnmower on the lawn.
- Version:
- 1.1, 30th June '97
- Author:
- Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.
- See Also:
- Lawn, LawnObserver
-
LawnViewer(Lawn)
- Create a new LawnViewer Object which provides a view of the specified
Lawn.
-
init()
- Initialise the position of the mower on the lawn.
-
lawnCutting(int, int)
- Update the lawn view when a square on the lawn is being cut.
-
lawnGrown()
- Update the lawn view when the lawn regrows.
-
paint(Graphics)
- Override the Canvas paint() method so that the lawn and lawnmower
is drawn on the Canvas.
-
update(Graphics)
- Override the Canvas update() method so that the Canvas is not cleared
before it is redrawn.
LawnViewer
public LawnViewer(Lawn lawn)
- Create a new LawnViewer Object which provides a view of the specified
Lawn.
- Parameters:
- lawn - The Lawn being viewed.
init
public void init()
- Initialise the position of the mower on the lawn.
update
public void update(Graphics g)
- Override the Canvas update() method so that the Canvas is not cleared
before it is redrawn.
- Parameters:
- g - The graphics Object associated with the Canvas.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Override the Canvas paint() method so that the lawn and lawnmower
is drawn on the Canvas.
- Parameters:
- g - The graphics Object associated with the Canvas.
- Overrides:
- paint in class Canvas
lawnGrown
public void lawnGrown()
- Update the lawn view when the lawn regrows.
lawnCutting
public void lawnCutting(int x,
int y)
- Update the lawn view when a square on the lawn is being cut.
- Parameters:
- x - The X-coordinate of the square being cut.
- y - The Y-coordinate of the square being cut.
All Packages Class Hierarchy This Package Previous Next Index