|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectobjectdraw.CanvasManager
class CanvasManager
A CanvasManager is automatically associated with each DrawingCanvas to manage the Drawable objects displayed on that canvas. CanvasManager provides methods to add, remove, or reorder objects on the canvas. Internally, the CanvasManager performs the steps necessary to update the image displayed when the collection of Drawables in changed in some way.
Field Summary | |
---|---|
static Dimension |
DEFAULT_PREFERRED_SIZE
The canvas' default preferred dimensions. |
Constructor Summary | |
---|---|
CanvasManager(Dimension size,
DrawingCanvas canvas)
Creates a CanvasManager. |
Method Summary | |
---|---|
(package private) void |
addToCanvas(Drawable d)
Adds a new object on top of existing objects. |
(package private) void |
clear()
Clears the vector of all objects and redraws the screen. |
void |
disableAutoRepaint()
Turns auto repaint off so the programmer must indicate when the canvas should be repainted. |
void |
enableAutoRepaint()
Turns auto repaint on so the programmer does not have to manually repaint after changing the canvas. |
protected DrawingCanvas |
getCanvas()
Access the DrawingCanvas associated with this manater |
DrawableIterator |
getDrawableIterator()
Creates and returns an iterator of all the objects in the CanvasManager |
(package private) void |
paint(Graphics g)
Paints the canvas. |
(package private) void |
removeFromCanvas(Drawable d)
Removes the Drawable d from the canvas. |
(package private) void |
sendObjectBackward(Drawable object)
Sends an object backward. |
(package private) void |
sendObjectForward(Drawable object)
Sends an object forward. |
(package private) void |
sendObjectToBack(Drawable object)
Sends an object to the back. |
(package private) void |
sendObjectToFront(Drawable object)
Sends an object to the front. |
(package private) void |
setStateChanged()
When invoked sets the stateChanged boolean to true and calls repaint() if enabled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Dimension DEFAULT_PREFERRED_SIZE
Constructor Detail |
---|
public CanvasManager(Dimension size, DrawingCanvas canvas)
size
- the dimensions of the canvasMethod Detail |
---|
void addToCanvas(Drawable d)
d
- the new objectvoid clear()
public void disableAutoRepaint()
public void enableAutoRepaint()
protected DrawingCanvas getCanvas()
public DrawableIterator getDrawableIterator()
void paint(Graphics g)
g
- the canvas' graphics context.void removeFromCanvas(Drawable d)
d
- the object to be removedvoid sendObjectBackward(Drawable object)
object
- the objectvoid sendObjectForward(Drawable object)
object
- the objectvoid sendObjectToBack(Drawable object)
object
- the object to movevoid sendObjectToFront(Drawable object)
object
- the object to movevoid setStateChanged()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |