|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swt.graphics.Rectangle
Instances of this class represent rectangular areas in an (x, y) coordinate system. The top left corner of the rectangle is specified by its x and y values, and the extent of the rectangle is specified by its width and height.
The coordinate space for rectangles and points is considered to have increasing values downward and to the right from its origin making this the normal, computer graphics oriented notion of (x, y) coordinates rather than the strict mathematical one.
The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted.
Application code does not need to explicitly release the resources managed by each instance when those instances are no longer required, and thus no dispose() method is provided.
Field Summary | |
int | height
the height of the rectangle |
int | width
the width of the rectangle |
int | x
the x coordinate of the rectangle |
int | y
the y coordinate of the rectangle |
Constructor Summary | |
Rectangle(int x,
int y,
int width,
int height)
Construct a new instance of this class given the x, y, width and height values. |
Method Summary | |
void | add(Rectangle rect)
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)
Returns true if the point specified by the arguments is inside the area specified by the receiver, and false otherwise. |
boolean | contains(Point pt)
Returns true if the given point is inside the area specified by the receiver, and false otherwise. |
boolean | equals(Object object)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. |
int | hashCode()
Returns an integer hash code for the receiver. |
void | intersect(Rectangle rect)
Destructively replaces the x, y, width and height values in the receiver with ones which represent the intersection of the rectangles specified by the receiver and the given rectangle. |
Rectangle | intersection(Rectangle rect)
Returns a new rectangle which represents the intersection of the receiver and the given rectangle. |
boolean | intersects(int x,
int y,
int width,
int height)
Returns true if the rectangle described by the arguments intersects with the receiver and false otherwise. |
boolean | intersects(Rectangle rect)
Returns true if the given rectangle intersects with the receiver and false otherwise. |
boolean | isEmpty()
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()
Returns a string containing a concise, human-readable description of the receiver. |
Rectangle | union(Rectangle rect)
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)
Method 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.
public boolean contains(int x, int y)
public boolean contains(Point pt)
public boolean equals(Object object)
public int hashCode()
public void intersect(Rectangle rect)
since 3.0
public Rectangle intersection(Rectangle rect)
The intersection of two rectangles is the rectangle that covers the area which is contained within both rectangles.
public boolean intersects(int x, int y, int width, int height)
Two rectangles intersect if the area of the rectangle representing their intersection is not empty.
public boolean intersects(Rectangle rect)
Two rectangles intersect if the area of the rectangle representing their intersection is not empty.
public boolean isEmpty()
A rectangle is considered to cover area in the (x, y) coordinate plane if both its width and height are non-zero.
public String toString()
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.
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.