Class ShapeCanvas

java.lang.Object
  extended by ShapeCanvas

public class ShapeCanvas
extends java.lang.Object

A Canvas class for doing basic graphical drawing. This particular canvas focuses on drawing shapes that have been "added" to it. Acts as a Singleton for ease of use.

Version:
Sp 2015
Author:
Joel Ross, based on class by Michael Kolling and Bruce Quig

Constructor Summary
ShapeCanvas()
           
 
Method Summary
static void addShape(DrawableShape shape)
          Adds the given shape to the canvas.
static void bringToFront(DrawableShape shape)
          Moves a shape to the front of the drawing
static void makeVisible()
          Shows the canvas frame, in case it was closed.
static void refresh()
          A method that refreshes what is displayed on the canvas.
static void removeShape(DrawableShape shape)
          Removes the given shape from the canvas
static void sendToBack(DrawableShape shape)
          Moves a shape to the back of the drawing
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeCanvas

public ShapeCanvas()
Method Detail

addShape

public static void addShape(DrawableShape shape)
Adds the given shape to the canvas. This instantiates the singleton canvas if not already created


bringToFront

public static void bringToFront(DrawableShape shape)
Moves a shape to the front of the drawing


makeVisible

public static void makeVisible()
Shows the canvas frame, in case it was closed.


refresh

public static void refresh()
A method that refreshes what is displayed on the canvas. This method redraws the shapes on the canvas.


removeShape

public static void removeShape(DrawableShape shape)
Removes the given shape from the canvas


sendToBack

public static void sendToBack(DrawableShape shape)
Moves a shape to the back of the drawing