|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objectdraw.CanvasManager
CanvasManager contains the methods which act on the actual canvas. In order to enable swing compatabliltiy the DrawingCanvas is now just a shell which is tailored to swing or awt and then calls the methods of this class when necessary. The actual painting and drawing and maintaince of the Vector of objects takes place in this class.
Field Summary | |
static java.awt.Dimension |
DEFAULT_PREFERRED_SIZE
The canvas' default preferred dimensions. |
Constructor Summary | |
CanvasManager(java.awt.Dimension size,
DrawingCanvas c)
Creates a CanvasManager |
Method Summary | |
void |
add(DrawableInterface object)
Adds a new object on top of existing objects. |
void |
addToCanvas(Drawable d)
If the Drawable d is not already on the canvas or if the canvas is null it sets d's canvas to this one and adds d to it. |
void |
clear()
Clears the Vector of all objects and tells the Container that the state has changed. |
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. |
DrawableIterator |
getObjectIterator()
Creates and returns an iterator of all the objects in the CanvasManager |
void |
paint(java.awt.Graphics g)
Paints the canvas. |
void |
redraw()
Redraws all objects on the canvas that are not currently hidden. |
void |
remove(DrawableInterface object)
Removes an object. |
void |
removeFromCanvas(Drawable d)
Removes the Drawable d from the Drawable d. |
void |
repaint()
Tells the DrawingCanvas to repaint(). |
void |
sendObjectBackward(DrawableInterface object)
Sends an object backward. |
void |
sendObjectForward(DrawableInterface object)
Sends an object forward. |
void |
sendObjectToBack(DrawableInterface object)
Sends an object to the back. |
void |
sendObjectToFront(DrawableInterface object)
Sends an object to the front. |
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 java.awt.Dimension DEFAULT_PREFERRED_SIZE
Constructor Detail |
public CanvasManager(java.awt.Dimension size, DrawingCanvas c)
Method Detail |
public void addToCanvas(Drawable d)
public void removeFromCanvas(Drawable d)
public void add(DrawableInterface object)
object
- the new objectpublic void remove(DrawableInterface object)
object
- the object to be removedpublic void clear()
public void setStateChanged()
public void paint(java.awt.Graphics g)
g
- the canvas' graphics context.public void redraw()
public void repaint()
public void enableAutoRepaint()
public void disableAutoRepaint()
public void sendObjectToFront(DrawableInterface object)
object
- the objectpublic void sendObjectToBack(DrawableInterface object)
object
- the objectpublic void sendObjectForward(DrawableInterface object)
object
- the objectpublic void sendObjectBackward(DrawableInterface object)
object
- the objectpublic DrawableIterator getObjectIterator()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |