|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
DrawableInterface describes the methods available for manipulating any graphical object placed on a DrawingCanvas.
Method Summary | |
void |
addToCanvas(DrawingCanvas c)
Places an existing object on a specified DrawingCanvas. |
boolean |
contains(Location point)
Determines if a particular position on the DrawingCanvas is contained within the object. |
DrawingCanvas |
getCanvas()
Determine which (if any) DrawingCanvas this object is positioned on |
java.awt.Color |
getColor()
Retrieves the color of the object. |
void |
hide()
Temporarily hides an object on a DrawingCanvas from view. |
boolean |
isHidden()
Determine whether an object is currently visible on its canvas |
void |
move(double dx,
double dy)
Moves the object within the canvas in the x and y direction by the amounts specified as parameters. |
void |
moveTo(double x,
double y)
Moves the object within the canvas to the x and y coordinates provided. |
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 |
show()
Shows the object if it has been hidden. |
Method Detail |
public void hide()
show()
method.
If the goal is to remove an object from the display permanently, the
removeFromCanvas()
method should be used instead.
public void show()
public void addToCanvas(DrawingCanvas c)
removeFromCanvas()
followed
by addToCanvas. This method can also be invoked to place a Drawable object on a
DrawingCanvas after the object is loaded from a file or other stream.
c
- the canvas on which the object should be drawnpublic void removeFromCanvas()
hide()
instead.
public DrawingCanvas getCanvas()
public boolean isHidden()
public void moveTo(Location point)
point
- the destination for moving the object.public void moveTo(double x, double y)
x
- horizontal coordinate of destination.y
- horizontal coordinate of destination.public void move(double dx, double dy)
dx
- the amount to move in the x-direction.dy
- the amount to move in the y-direction.public void setColor(java.awt.Color c)
c
- the color.public java.awt.Color getColor()
public void sendForward()
public void sendBackward()
public void sendToFront()
public void sendToBack()
public boolean contains(Location point)
point
- the position on the canvas.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |