Class DrawingBoard
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----DrawingBoard
- public class DrawingBoard
- extends Canvas
Class for displaying a drawing board.
- Version:
- 1.00 4 Dec 1997
- Author:
- Octavian Cismasu
-
DrawingBoard(PlumblineAlgorithm)
- Constructs a new DrawingBoard object that
has a handle on its parent container.
-
closePolygon()
- Finishes the construction of the polygon
by adding the starting vertex to the current list
of points of the polygon.
-
eraseBoard()
- Erases the graphics area of the DrawingBoard and
resets variables.
-
mouseDown(Event, int, int)
- Handles mouse events.
-
mouseMove(Event, int, int)
- Handles mouse move events.
-
paint(Graphics)
- Displays graphics in the context of this object
-
setPolygon(int[], int[])
- Draws a polygon whose coordinates are preset.
-
startPoint(int, int)
- Initializes variables for construction
of new polygon.
-
undoLastpoint()
- Removes the last polygon vertex that was added.
DrawingBoard
public DrawingBoard(PlumblineAlgorithm parentContainer)
- Constructs a new DrawingBoard object that
has a handle on its parent container.
- Parameters:
- parentContainer - the parent container of this object
paint
public void paint(Graphics g)
- Displays graphics in the context of this object
- Parameters:
- g - the graphics context
- Overrides:
- paint in class Canvas
mouseDown
public boolean mouseDown(Event evt,
int x,
int y)
- Handles mouse events.
- Parameters:
- evt - type of event
- x - the x-coordinate of the mouse
- y - the y coordinate of the mouse
- Overrides:
- mouseDown in class Component
mouseMove
public boolean mouseMove(Event evt,
int x,
int y)
- Handles mouse move events.
- Parameters:
- evt - type of event
- x - the x-coordinate of the mouse
- y - the y-coordinate of the mouse
- Overrides:
- mouseMove in class Component
startPoint
public void startPoint(int x,
int y)
- Initializes variables for construction
of new polygon.
- Parameters:
- x - the x-coordinate of the first polygon vertex
- y - the y-coordinate of the first polygon vertex
undoLastpoint
public void undoLastpoint()
- Removes the last polygon vertex that was added.
eraseBoard
public void eraseBoard()
- Erases the graphics area of the DrawingBoard and
resets variables. A new polygon can be constructed now.
closePolygon
public void closePolygon()
- Finishes the construction of the polygon
by adding the starting vertex to the current list
of points of the polygon.
setPolygon
public void setPolygon(int xpoints[],
int ypoints[])
- Draws a polygon whose coordinates are preset.
Sets flags accordingly.
- Parameters:
- xpoints - the x coordinates of each point
- ypoints - the y coordinates of each point