java.lang.ObjectCanvas
public class Canvas
Canvas is a class to allow for simple graphical drawing on a canvas. This is a modification of the general purpose Canvas, specially made for the BlueJ "shapes" example.
| Method Summary | |
|---|---|
void |
draw(java.lang.Object referenceObject,
java.lang.String color,
java.awt.Shape shape)
Draw a given shape onto the canvas. |
void |
erase(java.lang.Object referenceObject)
Erase a given shape's from the screen. |
static Canvas |
getCanvas()
Factory method to get the canvas singleton object. |
void |
setForegroundColor(java.lang.String colorString)
Set the foreground colour of the Canvas. |
void |
setVisible(boolean visible)
Set the canvas visibility and brings canvas to the front of screen when made visible. |
void |
wait(int milliseconds)
Wait for a specified number of milliseconds before finishing. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void draw(java.lang.Object referenceObject,
java.lang.String color,
java.awt.Shape shape)
referenceObject - an object to define identity for this shapecolor - the color of the shapeshape - the shape object to be drawn on the canvaspublic void erase(java.lang.Object referenceObject)
referenceObject - the shape object to be erasedpublic static Canvas getCanvas()
public void setForegroundColor(java.lang.String colorString)
newColour - the new colour for the foreground of the Canvaspublic void setVisible(boolean visible)
visible - boolean value representing the desired visibility of
the canvas (true or false)public void wait(int milliseconds)
milliseconds - the number