public class Rectangle
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected int |
height
The height of the rectangular area.
|
protected boolean |
isRelative
Wether the rectangular area is relative that is, it does not have valid
coordinates.
|
protected int |
width
The width of the rectangular area.
|
protected int |
x
The x-coordinate of the top-left corner of the rectangular area or -1 for a
relative rectangular area.
|
protected int |
y
The y-coordinate of the top-left corner of the rectangular area or -1 for a
relative rectangular area.
|
| Constructor and Description |
|---|
Rectangle(int x,
int y,
boolean point)
Creates a new point having the designated coordinates or a relative
rectangle with the designated extent.
|
Rectangle(int x,
int y,
int width,
int height)
Creates a new rectangle area with the designated coordinates of the
top-left corner, and the designated extent.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getHeight()
Gets the height of the rectangular area or 0 for a point.
|
int |
getWidth()
Gets the width of the rectangular area or 0 for a point.
|
int |
getX()
Gets the x-coordinate of the top-left corner of the rectangular area.
|
int |
getY()
Gets the y-coordinate of the top-left corner of the rectangular area.
|
boolean |
isRelative()
Gets whether the rectangular area is relative and therefore the coordinates
are invalid.
|
protected final int x
protected final int y
protected final int width
protected final int height
protected final boolean isRelative
public Rectangle(int x,
int y,
int width,
int height)
x - The x-coordinate of the top-left corner of the rectangular area.y - The y-coordinate of the top-left corner of the rectangular areawidth - The width of the rectangular area.height - The height of the rectangular area.public Rectangle(int x,
int y,
boolean point)
x - The x-coordinate of the point or the width of the relative
rectangular area.y - The y-coordinate of the point or the height of the relative
rectangular area.point - Whether to create a point (having no extent) or a relative
rectangular area.public int getX()
public int getY()
public int getWidth()
public int getHeight()
public boolean isRelative()