public abstract class DrawingObject
extends java.lang.Object
Constructor and Description |
---|
DrawingObject() |
Modifier and Type | Method and Description |
---|---|
static boolean |
clickHitEllipse(int px,
int py,
int x1,
int y1,
int x2,
int y2)
This utility function makes it easy to check whether
the coordinates of the user's mouse click (px,py) are
on (or very close to) the ellipse defined by the bounding
box with corners at (x1,y1) and (x2,y2).
|
static boolean |
clickHitLine(int px,
int py,
int x1,
int y1,
int x2,
int y2)
This utility function makes it easy to check whether
the coordinates of the user's mouse click (px,py) are
on (or very close to) the line between the two points,
(x1,y1) and (x2,y2).
|
abstract void |
drawObject(java.awt.Graphics2D g2)
This function is called to request that the object
draw itself using the provided Graphics2D context.
|
abstract java.awt.Rectangle |
getBoundingBox()
This function returns a Rectangle object that describes
the 'bounding box'.
|
abstract void |
resizeObject(int x1,
int y1,
int x2,
int y2)
This function changes the coordinates that define the
location and size of the object.
|
abstract boolean |
wasClicked(int px,
int py)
This function returns a boolean that indicates whether
the provided coordinate (px,py) hits any part of the
object.
|
public abstract void resizeObject(int x1, int y1, int x2, int y2)
public abstract boolean wasClicked(int px, int py)
public abstract java.awt.Rectangle getBoundingBox()
public abstract void drawObject(java.awt.Graphics2D g2)
public static boolean clickHitLine(int px, int py, int x1, int y1, int x2, int y2)
public static boolean clickHitEllipse(int px, int py, int x1, int y1, int x2, int y2)