|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectobjectdraw.Drawable
objectdraw.Drawable2D
abstract class Drawable2D
Drawable2D extends Drawable and defines a set of accessor methods for the width, height, and location of Drawable objects. It also defines methods to determine if objects overlap.
Field Summary |
---|
Fields inherited from class objectdraw.Drawable |
---|
canvasContent, color, shown |
Constructor Summary | |
---|---|
Drawable2D()
|
Method Summary | |
---|---|
boolean |
contains(Location point)
Determines if a particular position on the DrawingCanvas is contained within the object. |
(package private) void |
draw(Graphics g)
Draws the object. |
(package private) abstract Bounds |
getBounds()
Gets the object's bounding rectangle |
abstract double |
getHeight()
Get the height of a graphical object |
Location |
getLocation()
Get a graphical object's position |
abstract 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 |
boolean |
overlaps(Drawable2DInterface item)
Determines if another Drawable's bounding rectangle overlaps with this object's bounding rectangle. |
Methods inherited from class objectdraw.Drawable |
---|
addToCanvas, clearCanvasContent, getCanvas, getColor, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setCanvasContent, setColor, setStateChanged, show |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface objectdraw.DrawableInterface |
---|
addToCanvas, getCanvas, getColor, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show |
Constructor Detail |
---|
Drawable2D()
Method Detail |
---|
public boolean contains(Location point)
DrawableInterface
contains
in interface DrawableInterface
contains
in class Drawable
point
- the position on the canvas.
void draw(Graphics g)
draw
in class Drawable
g
- the graphics context into which the object is drawnabstract Bounds getBounds()
public abstract double getHeight()
Drawable2DInterface
getHeight
in interface Drawable2DInterface
public Location getLocation()
Drawable2DInterface
getLocation
in interface Drawable2DInterface
public abstract double getWidth()
Drawable2DInterface
getWidth
in interface Drawable2DInterface
public double getX()
Drawable2DInterface
getX
in interface Drawable2DInterface
public double getY()
Drawable2DInterface
getY
in interface Drawable2DInterface
public boolean overlaps(Drawable2DInterface item)
Drawable2DInterface
overlaps
in interface Drawable2DInterface
item
- the other object
true
if item intersects this object;
false
otherwise.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |