|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectobjectdraw.Bounds
class Bounds
Bounds is a non-drawable bounding rectangle in the real plane.
Constructor Summary | |
---|---|
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. |
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. |
Rectangle |
toRectangle()
Retrieves a Rectangle representation of the object. |
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(double x, double y, double width, double height)
x
- the x coordinate of the rectangle's left edgey
- the y coordinate of the rectangle's upper edgewidth
- the rectangle's widthheight
- the rectangle's heightpublic Bounds(Location location, double width, double height)
location
- the upper left corner of the rectanglewidth
- the width of the rectangleheight
- the height of the rectangleMethod Detail |
---|
public boolean contains(Location point)
point
- is the point to check
true
if point is contained in the object; false
otherwise.public double getHeight()
public Location getLocation()
public double getWidth()
public double getX()
public double getY()
public boolean intersects(Bounds b)
b
- another bounding rectangle
true
if b intersects this one; false
otherwise.public void setDimensions(double width, double height)
width
- is the new width desiredheight
- is the new height desiredpublic void setHeight(double height)
height
- the new height desiredpublic void setLocation(double x, double y)
x
- the x coordinate of the new location.y
- the y coordinate of the new location.public void setLocation(Location point)
point
- new location for the upper left corner of the
bounding rectanglepublic void setWidth(double width)
width
- the new width desiredpublic Rectangle toRectangle()
public String toString()
toString
in class Object
public 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 direction
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |