public class Rect extends Object implements Serializable
Constructor and Description |
---|
Rect(int x,
int y,
int width,
int height)
Constructs a rectangle from the given x and y coordinates, width, and height.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Checks whether or not this rectangle contains the point at the specified location (x,y).
|
boolean |
contains(Point point)
Checks whether or not this rectangle contains the specified point.
|
boolean |
contains(Rect rect)
Checks whether or not this rectangle entirely contains the specified rectangle.
|
boolean |
equals(Object obj) |
Point |
getCenter()
Returns the center of the rectangle.
|
int |
getHeight()
Returns the height of the rectangle.
|
int |
getWidth()
Returns the width of the rectangle.
|
int |
getX()
Returns the x coordinate of the rectangle.
|
int |
getY()
Returns the y coordinate of the rectangle.
|
int |
hashCode() |
boolean |
isEmpty()
Determines whether the rectangle is empty.
|
String |
toString() |
public Rect(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the height
public int getX()
public int getY()
public int getWidth()
public int getHeight()
public Point getCenter()
public boolean isEmpty()
true
if the rectangle is empty; false
otherwise
public boolean contains(int x, int y)
x
- the specified X coordinatey
- the specified Y coordinatetrue
if the point (x,y) is inside this rectangle;
public boolean contains(Point point)
point
- the point to testtrue
if this rectangle contains the specified point
public boolean contains(Rect rect)
rect
- the rectangle to testtrue
if this rectangle contains the other rectangle.
Copyright 2009-2012 Micro Focus. All Rights Reserved.