|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objectdraw.Drawable
Drawable is a general base class for objects being placed on a DrawingCanvas. Basic functionality includes the ability to show, hide, set the color of, and move Drawables.
Field Summary | |
protected DrawingCanvas |
canvas
The canvas in which the object exists. |
protected CanvasManager |
canvasContent
The contents of the canvas on which the object exists. |
protected java.awt.Color |
color
The object's color. |
protected static boolean |
DEBUGGING
|
protected boolean |
shown
Whether the object is currently visible on its canvas |
Constructor Summary | |
Drawable()
Creates a new Drawable object. |
Method Summary | |
void |
addToCanvas(DrawingCanvas c)
Sets the drawing canvas for the object. |
abstract boolean |
contains(Location point)
Determines if the object contains the given point. |
void |
draw(java.awt.Graphics g)
Draws the object. |
java.awt.Color |
getColor()
Retrieves the color of the object. |
void |
hide()
Hides the object. |
boolean |
isHidden()
returns True if the object is currently hidden. |
abstract void |
move(double dx,
double dy)
Moves the object within the canvas by the amount specified in the x and y direction. |
void |
moveTo(double x,
double y)
Moves the object within the canvas to the specified coordinates |
abstract void |
moveTo(Location point)
Moves the object within the canvas to the specified Location |
void |
removeFromCanvas()
Permanently removes the object from the canvas it is currently on. |
void |
sendBackward()
Sends the object backward. |
void |
sendForward()
Sends the object forward. |
void |
sendToBack()
Sends the object to the back. |
void |
sendToFront()
Sends the object to the front. |
void |
setColor(java.awt.Color c)
Sets the color of the object. |
void |
setStateChanged()
Sets the state of the object to be changed so that it gets repainted. |
void |
show()
Shows the object if it has been hidden. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient DrawingCanvas canvas
protected transient CanvasManager canvasContent
protected java.awt.Color color
protected boolean shown
protected static final boolean DEBUGGING
Constructor Detail |
public Drawable()
c
- the canvas in which the object will be createdMethod Detail |
public void addToCanvas(DrawingCanvas c)
addToCanvas
in interface DrawableInterface
c
- the canvas on which the object will be drawnpublic void removeFromCanvas()
removeFromCanvas
in interface DrawableInterface
c
- the canvas on which the object will be drawnpublic void setStateChanged()
public void draw(java.awt.Graphics g)
draw
in interface DrawableInterface
g
- the graphics context into which the object is drawnpublic void hide()
hide
in interface DrawableInterface
public void show()
show
in interface DrawableInterface
public boolean isHidden()
isHidden
in interface DrawableInterface
objectdraw.DrawableInterface
public abstract void moveTo(Location point)
moveTo
in interface DrawableInterface
point
- the coordinates of the upper left corner of the
object's new bounding boxpublic void moveTo(double x, double y)
moveTo
in interface DrawableInterface
x
- the x-coordinate of the upper left corner of the
object's bounding boxy
- the y-coordinate of the upper left corner of the
object's bounding boxpublic abstract void move(double dx, double dy)
move
in interface DrawableInterface
dx
- the amount to move in the x-directiondy
- the amount to move in the y-directionpublic abstract boolean contains(Location point)
contains
in interface DrawableInterface
point
- the pointtrue
if point is contained in the object;
false
otherwise.public void setColor(java.awt.Color c)
setColor
in interface DrawableInterface
c
- the colorpublic java.awt.Color getColor()
getColor
in interface DrawableInterface
public void sendForward()
sendForward
in interface DrawableInterface
public void sendBackward()
sendBackward
in interface DrawableInterface
public void sendToFront()
sendToFront
in interface DrawableInterface
public void sendToBack()
sendToBack
in interface DrawableInterface
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |