Class Rectangle
The Rectangle object is an area defined by its position.
Constructor Attributes | Constructor Name and Description |
---|---|
Constructor.
|
Field Attributes | Field Name and Description |
---|---|
The height of the rectangle.
|
|
The width of the rectangle.
|
|
The horizontal coordinate of the rectangle.
|
|
The vertical coordinate of the rectangle.
|
Method Attributes | Method Name and Description |
---|---|
clone()
Creates a copy of this Rectangle object.
|
|
containsPoint(x, y)
Checks this rectangle whether contains the point parameter.
|
|
intersection(rect)
Computes the intersection of this rectangle and the rectangle parameter.
|
|
intersects(rect)
Returns whether this rectangle intersects the rectangle parameter.
|
|
toString()
Returns a string that represent this Rectangle object.
|
Field Detail
height
The height of the rectangle.
width
The width of the rectangle.
x
The horizontal coordinate of the rectangle.
y
The vertical coordinate of the rectangle.
Method Detail
clone()
Creates a copy of this Rectangle object.
containsPoint(x, y)
Checks this rectangle whether contains the point parameter.
- Parameters:
- x
- y
intersection(rect)
Computes the intersection of this rectangle and the rectangle parameter.
- Parameters:
- rect
- A Rectangle.
intersects(rect)
Returns whether this rectangle intersects the rectangle parameter.
- Parameters:
- rect
- A Rectangle.
toString()
Returns a string that represent this Rectangle object.