public class Rectangle
extends java.awt.Rectangle
Constructor and Description |
---|
Rectangle()
Constructs a new
Rectangle whose top-left corner is at (0, 0) in the coordinate space, and
whose width and height are both zero. |
Rectangle(int x,
int y,
int width,
int height)
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(java.awt.Rectangle r)
Constructs a new
Rectangle , initialized to match the values of the specified
Rectangle . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Checks whether two rectangles are equal.
|
int |
getX1()
Return x1 position.
|
int |
getX2()
Return x2 position.
|
int |
getY1()
Return y1 position.
|
int |
getY2()
Return y2 position.
|
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
public Rectangle()
Rectangle
whose top-left corner is at (0, 0) in the coordinate space, and
whose width and height are both zero.public Rectangle(java.awt.Rectangle r)
Rectangle
, initialized to match the values of the specified
Rectangle
.r
- the Rectangle
from which to copy initial values to a newly constructed
Rectangle
public Rectangle(int x, int y, int width, int height)
Rectangle
whose top-left corner is specified as (x
,
y
) and whose width and height are specified by the arguments of the same name.x
- the specified x coordinatey
- the specified y coordinatewidth
- the width of the Rectangle
height
- the height of the Rectangle
public int getX1()
public int getX2()
public int getY1()
public int getY2()
public boolean equals(java.lang.Object obj)
The result is true
if and only if the argument is not null
and is a
Rectangle
object that has the same top-left corner, width, and height as this
Rectangle
.
equals
in class java.awt.Rectangle
obj
- the Object
to compare with this Rectangle
true
if the objects are equal; false
otherwise.