|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.swt.graphics.Rectangle
Safe:
Field Summary | |
int |
height
Enabled: the height of the rectangle |
int |
width
Enabled: the width of the rectangle |
int |
x
Enabled: the x coordinate of the rectangle |
int |
y
Enabled: the y coordinate of the rectangle |
Constructor Summary | |
Rectangle(int x,
int y,
int width,
int height)
Enabled: Construct a new instance of this class given the x, y, width and height values. |
Method Summary | |
void |
add(Rectangle rect)
Suppressed: Destructively replaces the x, y, width and height values in the receiver with ones which represent the union of the rectangles specified by the receiver and the given rectangle. |
boolean |
contains(int x,
int y)
Enabled: Returns true if the point specified by the
arguments is inside the area specified by the receiver,
and false otherwise. |
boolean |
contains(Point pt)
Enabled: Returns true if the given point is inside the
area specified by the receiver, and false
otherwise. |
boolean |
equals(Object object)
Suppressed: Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. |
int |
hashCode()
Suppressed: Returns an integer hash code for the receiver. |
Rectangle |
intersection(Rectangle rect)
Enabled: Returns a new rectangle which represents the intersection of the receiver and the given rectangle. |
boolean |
intersects(Rectangle rect)
Enabled: Returns true if the given rectangle intersects
with the receiver and false otherwise. |
boolean |
isEmpty()
Enabled: Returns true if the receiver does not cover any
area in the (x, y) coordinate plane, and false if
the receiver does cover some area in the plane. |
String |
toString()
Suppressed: Returns a string containing a concise, human-readable description of the receiver. |
Rectangle |
union(Rectangle rect)
Enabled: Returns a new rectangle which represents the union of the receiver and the given rectangle. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public int x
public int y
public int width
public int height
Constructor Detail |
public Rectangle(int x, int y, int width, int height)
x
- the x coordinate of the origin of the rectangley
- the y coordinate of the origin of the rectanglewidth
- the width of the rectangleheight
- the height of the rectangleMethod Detail |
public void add(Rectangle rect)
The union of two rectangles is the smallest single rectangle that completely covers both of the areas covered by the two given rectangles.
rect
- the rectangle to merge with the receiverpublic boolean contains(int x, int y)
true
if the point specified by the
arguments is inside the area specified by the receiver,
and false
otherwise.
x
- the x coordinate of the point to test for containmenty
- the y coordinate of the point to test for containment
true
if the rectangle contains the point and false
otherwisepublic boolean contains(Point pt)
true
if the given point is inside the
area specified by the receiver, and false
otherwise.
pt
- the point to test for containment
true
if the rectangle contains the point and false
otherwisepublic boolean equals(Object object)
equals
in class Object
object
- the object to compare with this object
true
if the object is the same as this object and false
otherwisehashCode()
public int hashCode()
true
when passed to
equals
must return the same value for this
method.
hashCode
in class Object
equals(java.lang.Object)
public Rectangle intersection(Rectangle rect)
The intersection of two rectangles is the rectangle that covers the area which is contained within both rectangles.
rect
- the rectangle to intersect with the receiver
public boolean intersects(Rectangle rect)
true
if the given rectangle intersects
with the receiver and false
otherwise.
Two rectangles intersect if the area of the rectangle representing their intersection is not empty.
rect
- the rectangle to test for intersection
true
if the rectangle intersects with the receiver, and false
otherwiseintersection(org.eclipse.swt.graphics.Rectangle)
,
isEmpty()
public boolean isEmpty()
true
if the receiver does not cover any
area in the (x, y) coordinate plane, and false
if
the receiver does cover some area in the plane.
A rectangle is considered to cover area in the (x, y) coordinate plane if both its width and height are non-zero.
true
if the receiver is empty, and false
otherwisepublic String toString()
toString
in class Object
public Rectangle union(Rectangle rect)
The union of two rectangles is the smallest single rectangle that completely covers both of the areas covered by the two given rectangles.
rect
- the rectangle to perform union with
add(org.eclipse.swt.graphics.Rectangle)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |