Example usage for Java java.awt Rectangle fields, constructors, methods, implement or subclass
The text is from its open source code.
Rectangle(int x, int y, int width, int height) Constructs a new Rectangle whose upper-left corner is specified as (x,y) and whose width and height are specified by the arguments of the same name. | |
Rectangle(int width, int height) Constructs a new Rectangle whose upper-left corner is at (0, 0) in the coordinate space, and whose width and height are specified by the arguments of the same name. | |
Rectangle(Point p, Dimension d) Constructs a new Rectangle whose upper-left corner is specified by the Point argument, and whose width and height are specified by the Dimension argument. | |
Rectangle() Constructs a new Rectangle whose upper-left corner is at (0, 0) in the coordinate space, and whose width and height are both zero. | |
Rectangle(Rectangle r) Constructs a new Rectangle , initialized to match the values of the specified Rectangle . | |
Rectangle(Point p) Constructs a new Rectangle whose upper-left corner is the specified Point , and whose width and height are both zero. | |
Rectangle(Dimension d) Constructs a new Rectangle whose top left corner is (0, 0) and whose width and height are specified by the Dimension argument. |
void | add(int newx, int newy) Adds a point, specified by the integer arguments newx,newy to the bounds of this Rectangle . |
void | add(Point pt) Adds the specified Point to the bounds of this Rectangle . |
void | add(Rectangle r) Adds a Rectangle to this Rectangle . |
Object | clone() Creates a new object of the same class and with the same contents as this object. |
boolean | contains(Point p) Checks whether or not this Rectangle contains the specified Point . |
boolean | contains(Rectangle r) Checks whether or not this Rectangle entirely contains the specified Rectangle . |
boolean | contains(int x, int y) Checks whether or not this Rectangle contains the point at the specified location (x,y) . |
boolean | contains(int X, int Y, int W, int H) Checks whether this Rectangle entirely contains the Rectangle at the specified location (X,Y) with the specified dimensions (W,H) . |
Rectangle2D | createIntersection(Rectangle2D r) |
Rectangle2D | createUnion(Rectangle2D r) |
boolean | equals(Object obj) Checks whether two rectangles are equal. |
Rectangle | getBounds() Gets the bounding Rectangle of this Rectangle . |
Rectangle2D | getBounds2D() |
double | getCenterX() Returns the X coordinate of the center of the framing rectangle of the Shape in double precision. |
double | getCenterY() Returns the Y coordinate of the center of the framing rectangle of the Shape in double precision. |
Class> | getClass() Returns the runtime class of this Object . |
double | getHeight() Returns the height of the bounding Rectangle in double precision. |
Point | getLocation() Returns the location of this Rectangle . |
double | getMaxX() Returns the largest X coordinate of the framing rectangle of the Shape in double precision. |
double | getMaxY() Returns the largest Y coordinate of the framing rectangle of the Shape in double precision. |
double | getMinX() Returns the smallest X coordinate of the framing rectangle of the Shape in double precision. |
double | getMinY() Returns the smallest Y coordinate of the framing rectangle of the Shape in double precision. |
Dimension | getSize() Gets the size of this Rectangle , represented by the returned Dimension . |
double | getWidth() Returns the width of the bounding Rectangle in double precision. |
double | getX() Returns the X coordinate of the bounding Rectangle in double precision. |
double | getY() Returns the Y coordinate of the bounding Rectangle in double precision. |
void | grow(int h, int v) Resizes the Rectangle both horizontally and vertically. |
Rectangle | intersection(Rectangle r) Computes the intersection of this Rectangle with the specified Rectangle . |
boolean | intersects(Rectangle r) Determines whether or not this Rectangle and the specified Rectangle intersect. |
boolean | intersects(double x, double y, double w, double h) |
boolean | isEmpty() |
int | outcode(double x, double y) |
void | setBounds(int x, int y, int width, int height) Sets the bounding Rectangle of this Rectangle to the specified x , y , width , and height . |
void | setBounds(Rectangle r) Sets the bounding Rectangle of this Rectangle to match the specified Rectangle . |
void | setFrame(double x, double y, double w, double h) Sets the location and size of the outer bounds of this Rectangle2D to the specified rectangular values. |
void | setLocation(int x, int y) Moves this Rectangle to the specified location. |
void | setLocation(Point p) Moves this Rectangle to the specified location. |
void | setRect(double x, double y, double width, double height) Sets the bounds of this Rectangle to the integer bounds which encompass the specified x , y , width , and height . |
void | setRect(Rectangle2D r) Sets this Rectangle2D to be the same as the specified Rectangle2D . |
void | setSize(Dimension d) Sets the size of this Rectangle to match the specified Dimension . |
void | setSize(int width, int height) Sets the size of this Rectangle to the specified width and height. |
String | toString() Returns a String representing this Rectangle and its values. |
void | translate(int dx, int dy) Translates this Rectangle the indicated distance, to the right along the X coordinate axis, and downward along the Y coordinate axis. |
Rectangle | union(Rectangle r) Computes the union of this Rectangle with the specified Rectangle . |
void | union(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest) Unions the pair of source Rectangle2D objects and puts the result into the specified destination Rectangle2D object. |