java.lang.ObjectShapeCanvas
public class ShapeCanvas
A Canvas class for doing basic graphical drawing. This particular canvas focuses on drawing shapes that have been "added" to it.
Constructor Summary | |
---|---|
ShapeCanvas(java.lang.String title)
Create a Canvas with default height and width (400 x 400) |
|
ShapeCanvas(java.lang.String title,
int width,
int height)
Create a Canvas. |
Method Summary | |
---|---|
void |
addShape(DrawableShape shape)
Adds a Shape to the canvas. |
static void |
main(java.lang.String[] args)
|
void |
refresh()
A method that refreshes what is displayed on the canvas. |
void |
removeShape(DrawableShape shape)
Removes a Shape from the canvas. |
void |
toggleAutomaticRefresh()
Toggles whether the canvas should automatically refresh. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShapeCanvas(java.lang.String title)
title
- title to appear in Canvas Framepublic ShapeCanvas(java.lang.String title, int width, int height)
title
- title to appear in Canvas Framewidth
- the desired width for the canvasheight
- the desired height for the canvasMethod Detail |
---|
public void addShape(DrawableShape shape)
shape
- the Shape to add to the canvaspublic static void main(java.lang.String[] args)
public void refresh()
public void removeShape(DrawableShape shape)
shape
- the Shape to remove from the canvaspublic void toggleAutomaticRefresh()