|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--objectdraw.Bounds
Bounds is a non-drawable bounding rectangle in the real plane.
Constructor Summary | |
Bounds(Bounds b)
Constructs a new Bounds object based on another Bounds object. |
|
Bounds(double x,
double y,
double width,
double height)
Constructs a new Bounds object. |
|
Bounds(Location location,
double width,
double height)
Constructs a new Bounds object. |
|
Bounds(java.awt.Rectangle r)
Constructs a new Bounds object based on a Rectangle object. |
Method Summary | |
boolean |
contains(Location point)
Determines if a point is contained by the object. |
double |
getHeight()
Retrieves the bounding rectangle's height. |
Location |
getLocation()
Retrieves the location of the bounding rectangle's upper left corner. |
double |
getWidth()
Retrieves the bounding rectangle's width. |
double |
getX()
Retrieves the x coordinate of the bounding rectangle's upper left corner. |
double |
getY()
Retrieves the y coordinate of the bounding rectangle's upper left corner. |
boolean |
intersects(Bounds b)
Determines if another Bounds object intersects this one. |
void |
setDimensions(double width,
double height)
Sets the rectangle's width and height. |
void |
setHeight(double height)
Sets the bounding rectangle's height. |
void |
setLocation(double x,
double y)
Sets a new location for the upper left corner of the bounding rectangle. |
void |
setLocation(Location point)
Sets a new location for the upper left corner of the bounding rectangle. |
void |
setWidth(double width)
Sets the bounding rectangle's width. |
java.awt.Rectangle |
toRectangle()
Retrieves a Rectangle representation of the object. |
java.lang.String |
toString()
Retrieves a string representation of the object. |
void |
translate(double dx,
double dy)
Translates the rectangle by the given increments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Bounds(Location location, double width, double height)
location
- the upper left corner of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglepublic Bounds(double x, double y, double width, double height)
x
- the x value of the rectangle's left edgey
- the y value of the rectangle's upper edgewidth
- the rectangle's widthheight
- the rectangle's heightpublic Bounds(java.awt.Rectangle r)
r
- is the Java awt Rectangle to be converted into a Bounds objectpublic Bounds(Bounds b)
b
- is an existing Bounds object to be copiedMethod Detail |
public Location getLocation()
public double getX()
public double getY()
public double getWidth()
public double getHeight()
public void setLocation(Location point)
point
- specifies a new location for the upper
left corner of the bounding rectanglepublic void setLocation(double x, double y)
x
- the x coordinate of the new location.y
- the y coordinate of the new location.public void setWidth(double width)
width
- is the new width desiredpublic void setHeight(double height)
height
- is the new height desiredpublic void setDimensions(double width, double height)
width
- is the new width desiredheight
- is the new height desiredpublic void translate(double dx, double dy)
dx
- is the amount to shift the rectangle in the x directiondy
- is the amount to shift the rectangle in the y directionpublic boolean contains(Location point)
point
- is the point to checktrue
if point is contained in the object;
false
otherwise.public boolean intersects(Bounds b)
b
- another bounding rectangletrue
if b intersects this one;
false
otherwise.public java.awt.Rectangle toRectangle()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |