public class Rect
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
Rect() |
Rect(int left,
int top,
int right,
int bottom)
Construct a new Rect with specified left, top, right, and bottom.
|
Rect(Rect r) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
boolean |
contains(Point p) |
void |
expandBottom(int bottom,
int thick)
Push the Rect's bottom boundary downward if necessary.
|
void |
expandHorizontal(int h,
int thick) |
void |
expandLeft(int left,
int thick)
Push the Rect's left boundary leftward if necessary.
|
void |
expandPoint(Point point,
int thick) |
void |
expandRight(int right,
int thick)
Push the Rect's righthand boundary rightward if necessary.
|
void |
expandTop(int top,
int thick)
Push the Rect's top boundary upward if necessary.
|
void |
expandVertical(int v,
int thick) |
int |
getArea() |
Dim |
getDim() |
int |
getHeight() |
Point |
getMidPoint() |
int |
getWidth() |
void |
setRect(int newleft,
int newtop,
int newright,
int newbottom) |
java.lang.String |
toString() |
Rect |
unionRect(Rect r)
Expand this rectangle where necessary so that it encompasses the given
rectangle.
|
void |
zero() |
void |
zeroRect() |
public int left
public int right
public int top
public int bottom
public Rect()
public Rect(int left, int top, int right, int bottom)
left
- left edge of the rectangle.top
- top edge of the rectangle.right
- right edge of the rectangle.bottom
- bottom edge of the rectangle.public Rect(Rect r)
public java.lang.Object clone()
clone
in class java.lang.Object
public int getArea()
public void zero()
public void expandLeft(int left, int thick)
left
- the potential new lefthand boundarythick
- the thickness of the drawing primitivepublic void expandRight(int right, int thick)
right
- the potential new righthand boundarythick
- the thickness of the drawing primitivepublic void expandTop(int top, int thick)
top
- the potential new top boundarythick
- the thickness of the drawing primitivepublic void expandBottom(int bottom, int thick)
bottom
- the potential new bottom boundarythick
- the thickness of the drawing primitivepublic void expandPoint(Point point, int thick)
public void expandHorizontal(int h, int thick)
public void expandVertical(int v, int thick)
public Point getMidPoint()
public java.lang.String toString()
toString
in class java.lang.Object
public Rect unionRect(Rect r)
r
- the rectangle to be union'ed with this one.public int getWidth()
public int getHeight()
public Dim getDim()
public void setRect(int newleft, int newtop, int newright, int newbottom)
public void zeroRect()
public boolean contains(Point p)