|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectobjectdraw.Drawable
objectdraw.Drawable2D
objectdraw.Resizable2D
objectdraw.VisibleImage
A VisibleImage represents an Image that can be drawn on the canvas.
| Constructor Summary | |
VisibleImage(java.awt.Image image,
double x,
double y,
double width,
double height,
DrawingCanvas canvas)
Creates a new VisibleImage object. |
|
VisibleImage(java.awt.Image image,
double x,
double y,
DrawingCanvas canvas)
Creates a new VisibleImage object. |
|
VisibleImage(java.awt.Image image,
Location origin,
double width,
double height,
DrawingCanvas canvas)
Creates a new VisibleImage object. |
|
VisibleImage(java.awt.Image image,
Location origin,
DrawingCanvas canvas)
Creates a new VisibleImage object. |
|
| Method Summary | |
void |
addToCanvas(DrawingCanvas canvas)
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. |
double |
getHeight()
Get the height of a graphical object |
java.awt.Image |
getImage()
Access the (unscaled) Image currently displayed by this VisibleImage |
Location |
getLocation()
Get a graphical object's position |
double |
getWidth()
Get the width of a graphical object |
double |
getX()
Get the x coordinate of left edge of rectangle bounding the object |
double |
getY()
Get the y coordinate of top edge of rectangle bounding 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 location)
Moves the object within the canvas to the specified Location |
boolean |
overlaps(Drawable2DInterface item)
Determines if another Drawable's bounding rectangle overlaps with this object's bounding rectangle. |
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 |
setHeight(double height)
Sets the height of the object's bounding rectangle |
void |
setImage(java.awt.Image newImage)
Change the Image displayed by this VisibleImage |
void |
setSize(double width,
double height)
Sets the width and height of the rectangle bounding the object. |
void |
setWidth(double width)
Sets the width of the object's bounding rectangle |
void |
show()
Shows the object if it has been hidden. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface objectdraw.Drawable2DInterface |
getLocation, getX, getY, overlaps |
| Methods inherited from interface objectdraw.DrawableInterface |
contains, getCanvas, getColor, hide, isHidden, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show |
| Constructor Detail |
public VisibleImage(java.awt.Image image,
Location origin,
DrawingCanvas canvas)
image - the image to displayorigin - the upper left corner of the bounding rectanglecanvas - the canvas in which the image is created
public VisibleImage(java.awt.Image image,
double x,
double y,
DrawingCanvas canvas)
image - the image to displayx - coordinate of the upper left corner of the bounding rectangley - coordinate of the upper left corner of the bounding rectanglecanvas - the canvas in which the image is created
public VisibleImage(java.awt.Image image,
Location origin,
double width,
double height,
DrawingCanvas canvas)
image - the image to displayorigin - the upper left corner of the bounding rectanglewidth - the width of the bounding rectangleheight - the height of the bounding rectanglecanvas - the canvas in which the image is created
public VisibleImage(java.awt.Image image,
double x,
double y,
double width,
double height,
DrawingCanvas canvas)
image - the image to displayx - coordinate of the upper left corner of the bounding rectangley - coordinate of the upper left corner of the bounding rectanglewidth - the width of the bounding rectangleheight - the height of the bounding rectanglecanvas - the canvas in which the image is created| Method Detail |
public void addToCanvas(DrawingCanvas canvas)
DrawableInterfaceremoveFromCanvas() 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.
addToCanvas in interface DrawableInterfacepublic void moveTo(Location location)
DrawableInterface
moveTo in interface DrawableInterface
public void move(double dx,
double dy)
DrawableInterface
move in interface DrawableInterfacepublic java.awt.Image getImage()
public void setImage(java.awt.Image newImage)
newImage - the Image to be displayed
public void setSize(double width,
double height)
Resizable2DInterface
setSize in interface Resizable2DInterfacepublic void setWidth(double width)
Resizable2DInterface
setWidth in interface Resizable2DInterfacepublic void setHeight(double height)
Resizable2DInterface
setHeight in interface Resizable2DInterfacepublic double getWidth()
Drawable2DInterface
getWidth in interface Drawable2DInterfacepublic double getHeight()
Drawable2DInterface
getHeight in interface Drawable2DInterfacepublic double getX()
Drawable2DInterface
getX in interface Drawable2DInterfacepublic double getY()
Drawable2DInterface
getY in interface Drawable2DInterfacepublic Location getLocation()
Drawable2DInterface
getLocation in interface Drawable2DInterfacepublic boolean contains(Location point)
DrawableInterface
contains in interface DrawableInterfacepublic boolean overlaps(Drawable2DInterface item)
Drawable2DInterface
overlaps in interface Drawable2DInterfaceitem - the other object
true if item intersects this object;
false otherwise.public void removeFromCanvas()
DrawableInterfacehide() instead.
removeFromCanvas in interface DrawableInterfacepublic DrawingCanvas getCanvas()
DrawableInterface
getCanvas in interface DrawableInterfacepublic void hide()
DrawableInterfaceshow() method.
If the goal is to remove an object from the display permanently, the
removeFromCanvas() method should be used instead.
hide in interface DrawableInterfacepublic void show()
DrawableInterface
show in interface DrawableInterfacepublic boolean isHidden()
DrawableInterface
isHidden in interface DrawableInterface
public void moveTo(double x,
double y)
DrawableInterface
moveTo in interface DrawableInterfacex - horizontal coordinate of destination.y - horizontal coordinate of destination.public void setColor(java.awt.Color c)
DrawableInterface
setColor in interface DrawableInterfacec - the color.public java.awt.Color getColor()
DrawableInterface
getColor in interface DrawableInterfacepublic void sendForward()
DrawableInterface
sendForward in interface DrawableInterfacepublic void sendBackward()
DrawableInterface
sendBackward in interface DrawableInterfacepublic void sendToFront()
DrawableInterface
sendToFront in interface DrawableInterfacepublic void sendToBack()
DrawableInterface
sendToBack in interface DrawableInterface
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||