|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjjil.core.Rect
public class Rect
Rect represents a rectangular region. The rectangle is specified using its upper left coordinate and size or the upper left and lower right coordinates. Methods allow the addition of a new point to the rectangle, merging rectangles, computing rectangle size, etc.
Constructor Summary | |
---|---|
Rect()
Creates a new instance of Rect |
|
Rect(int nTlx,
int nTly,
int nWidth,
int nHeight)
Create a new Rect specifying the upper left coordinate and size. |
|
Rect(Point p)
Create a new Rect (0 width and height) from a single point. |
|
Rect(Point p1,
Point p2)
Create a new Rect specifying two corners. |
Method Summary | |
---|---|
void |
add(Point p)
Add a new point to the Rect, extending it if necessary. |
int |
getArea()
Return area of the rectangle. |
int |
getHeight()
Return the height of the rectangle. |
int |
getLeft()
Return the left (horizontal) position of the rectangle. |
int |
getTop()
Return the top (vertical) position of the rectangle. |
int |
getWidth()
Return the width of the rectangle. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Rect()
public Rect(int nTlx, int nTly, int nWidth, int nHeight)
nTlx
- the upper left x (horizontal) coordinatenTly
- the upper left y (vertical) coordinatenWidth
- the widthnHeight
- the heightpublic Rect(Point p1, Point p2)
p1
- the first corner.p2
- the second corner.public Rect(Point p)
p
- the point.Method Detail |
---|
public void add(Point p)
p
- the new Pointpublic int getArea()
public int getLeft()
public int getHeight()
public int getTop()
public int getWidth()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |