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

Constructor Index

 o DrawingBoard(PlumblineAlgorithm)
Constructs a new DrawingBoard object that has a handle on its parent container.

Method Index

 o closePolygon()
Finishes the construction of the polygon by adding the starting vertex to the current list of points of the polygon.
 o eraseBoard()
Erases the graphics area of the DrawingBoard and resets variables.
 o mouseDown(Event, int, int)
Handles mouse events.
 o mouseMove(Event, int, int)
Handles mouse move events.
 o paint(Graphics)
Displays graphics in the context of this object
 o setPolygon(int[], int[])
Draws a polygon whose coordinates are preset.
 o startPoint(int, int)
Initializes variables for construction of new polygon.
 o undoLastpoint()
Removes the last polygon vertex that was added.

Constructors

 o 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

Methods

 o paint
  public void paint(Graphics g)
Displays graphics in the context of this object

Parameters:
g - the graphics context
Overrides:
paint in class Canvas
 o 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
 o 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
 o 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
 o undoLastpoint
  public void undoLastpoint()
Removes the last polygon vertex that was added.

 o eraseBoard
  public void eraseBoard()
Erases the graphics area of the DrawingBoard and resets variables. A new polygon can be constructed now.

 o closePolygon
  public void closePolygon()
Finishes the construction of the polygon by adding the starting vertex to the current list of points of the polygon.

 o 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