Fields
Name | Description |
---|---|
height | The height of the rectangle. |
width | The width of the rectangle. |
x | The x coordinate of the rectangle. |
y | The y coordinate of the rectangle. |
Constructors
Name | Description |
---|---|
Rectangle() | Constructs a new rectangle whose top-left corner is at (0, 0) in the coordinate space, and whose width and height are zero. |
Rectangle(Dimension) | Constructs a new rectangle whose top left corner is (0, 0) and whose width and height are specified by the dimension argument. |
Rectangle(int, int) | Constructs a new rectangle whose top-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(int, int, int, int) | Constructs a new rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name. |
Rectangle(Point) | Constructs a new rectangle whose top-left corner is the specified point, and whose width and height are zero. |
Rectangle(Point, Dimension) | Constructs a new rectangle whose top-left corner is specified by the point argument, and whose width and height are specified by the dimension argument. |
Rectangle(Rectangle) | Constructs a new rectangle, initialized to match the values of the specificed rectangle. |
Methods
Name | Description |
---|---|
add(int, int) | Adds a point, specified by the integer arguments newx and newy, to a rectangle. |
add(Point) | Adds a point to this rectangle. |
add(Rectangle) | Adds a rectangle to this rectangle. |
contains(int, int) | Checks whether this rectangle contains the point at the specified location (x, y). |
contains(Point) | Checks whether this rectangle contains the specified point. |
equals(Object) | Checks whether two rectangles are equal. |
getBounds() | Gets the bounding rectangle of this rectangle. |
getLocation() | Returns the location of this rectangle. |
getSize() | Gets the size (width and height) of this rectangle. |
grow(int, int) | Grows the rectangle both horizontally and vertically. |
hashCode() | Returns the hashcode for this rectangle. |
inside(int, int) | Deprecated. |
intersection(Rectangle) | Computes the intersection of this rectangle with the specified rectangle. |
intersects(Rectangle) | Determines whether this rectangle and the specified rectangle intersect. |
isEmpty() | Determines whether this rectangle is empty. |
move(int, int) | Deprecated. |
reshape(int, int, int, int) | Deprecated. |
resize(int, int) | Deprecated. |
setBounds(int, int, int, int) | Sets the bounding rectangle of this rectangle to the specified values for x, y, width, and height. |
setBounds(Rectangle) | Sets the bounding rectangle of this rectangle to match the specified rectangle. |
setLocation(int, int) | Moves the rectangle to the specified location. |
setLocation(Point) | Moves the rectangle to the specified location. |
setSize(Dimension) | Sets the size of this rectangle to match the specified dimension. |
setSize(int, int) | Sets the size of this rectangle to the specified width and height. |
toString() | Returns a string representation of this rectangle and its values. |
translate(int, int) | Translates the rectangle the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis. |
union(Rectangle) | Computes the union of this rectangle with the specified rectangle. |