| Constructor and Description |
|---|
GObject()
Constructs a new empty object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(float x,
float y)
Checks to see whether a point is inside the object.
|
boolean |
contains(GPoint pt)
Checks to see whether a point is inside the object.
|
float |
getBottomY()
Returns the max Y of this object.
|
GRectangle |
getBounds()
Returns the bounding box of this object, which is defined to be
the smallest rectangle that covers everything drawn by the figure.
|
float |
getCenterX()
Returns the x-value of the center of this object.
|
float |
getCenterY()
Returns the y-value of the center of this object.
|
Paint |
getColor()
Returns the color used to display this object.
|
GCanvas |
getGCanvas()
Returns the simple canvas this GObject is drawn inside of.
|
float |
getHeight()
Returns the height of this object, which is defined to be the height of the bounding box.
|
GPoint |
getLocation()
Returns the location of this object as a GPoint.
|
Paint |
getPaint()
Returns the color used to display this object.
|
float |
getRightX()
Returns the max X of this object.
|
GDimension |
getSize()
Returns the size of the bounding box for this object.
|
float |
getWidth()
Returns the width of this object, which is defined to be the width of the bounding box.
|
float |
getX()
Returns the x-coordinate of the object.
|
float |
getY()
Returns the y-coordinate of the object.
|
boolean |
intersects(GObject obj)
True if this object touches the other object.
|
boolean |
isVisible()
Checks to see whether this object is visible.
|
void |
moveBy(float dx,
float dy)
Moves the object on the screen using the displacements dx and dy.
|
void |
moveByPolar(float r,
float theta)
Moves the object using displacements given in polar coordinates.
|
void |
moveTo(float x,
float y)
Moves the object on the screen using the displacements dx and dy.
|
void |
moveTo(GObject gobj)
Moves this GObject to have the same location as the given other GObject.
|
void |
moveToPolar(float r,
float theta)
Moves the object using displacements given in polar coordinates.
|
abstract void |
paint(Canvas canvas)
All subclasses of GObject must define a paint method which allows the object to draw itself on the Graphics context passed in as the parameter g.
|
void |
repaint() |
void |
sendBackward()
Moves this object one step toward the back in the z dimension.
|
void |
sendForward()
Moves this object one step toward the front in the z dimension.
|
void |
sendToBack()
Moves this object to the back of the display in the z dimension.
|
void |
sendToFront()
Moves this object to the front of the display in the z dimension.
|
void |
setBottomY(float bottomY)
Sets the object's bottom y-coordinate to be the given value.
|
void |
setCanvas(Canvas canvas)
Sets the canvas this object is in.
|
void |
setColor(Paint paint)
Sets the color used to display this object.
|
void |
setGCanvas(GCanvas gcanvas)
Sets the canvas on which this GObject should be drawn.
|
void |
setLocation(float x,
float y)
Sets the location of this object to the point (x, y).
|
void |
setLocation(GObject gobj)
Moves this GObject to have the same location as the given other GObject.
|
void |
setPaint(Paint paint)
Sets the color used to display this object.
|
void |
setRightX(float rightX)
Sets the object's rightmost x-coordinate to be the given value.
|
void |
setVisible(boolean visible)
Sets whether this object is visible.
|
void |
setX(float x)
Sets the x-location of this object.
|
void |
setY(float y)
Sets the y-location of this object.
|
String |
toString()
Returns a string representation of this object, including its
class name, x/y coordinates, width, and height.
|
void |
translate(float dx,
float dy)
Moves the object on the screen using the displacements dx and dy.
|
public boolean contains(float x,
float y)
public boolean contains(GPoint pt)
public GRectangle getBounds()
public Paint getColor()
public Paint getPaint()
public float getHeight()
public GPoint getLocation()
public GDimension getSize()
public float getWidth()
public float getX()
public float getY()
public float getCenterX()
public float getRightX()
public float getCenterY()
public float getBottomY()
public boolean intersects(GObject obj)
public boolean isVisible()
public void moveBy(float dx,
float dy)
public void moveByPolar(float r,
float theta)
public void moveTo(GObject gobj)
public void translate(float dx,
float dy)
public void moveTo(float x,
float y)
public void moveToPolar(float r,
float theta)
public abstract void paint(Canvas canvas)
public void repaint()
public void sendBackward()
public void sendForward()
public void sendToBack()
public void sendToFront()
public void setCanvas(Canvas canvas)
public void setColor(Paint paint)
public void setPaint(Paint paint)
public void setLocation(float x,
float y)
public void setLocation(GObject gobj)
public void setX(float x)
public void setY(float y)
public void setRightX(float rightX)
public void setBottomY(float bottomY)
public void setGCanvas(GCanvas gcanvas)
public GCanvas getGCanvas()
public void setVisible(boolean visible)