Rectangle
Leave feedback
On this page
Inheritance: java.lang.Object
public class Rectangle
Represents a rectangular area.
| Constructor | Description |
|---|---|
| Rectangle(double left, double top, double right, double bottom) | Initializes a new instance of the Rectangle class. |
| Rectangle(Point position, Size size) | Initializes a new instance of the Rectangle class. |
| Method | Description |
|---|---|
| getLeft() | Gets the x-coordinate of the left edge of the rectangular area. |
| getTop() | Gets the y-coordinate of the top edge of the rectangular area. |
| getRight() | Gets the x-coordinate of the right egde of the rectangular area. |
| getBottom() | Gets the y-coordinate of the bottom edge of the rectangular area. |
| getPosition() | Gets the coordinates of the upper-left corner of the rectangular area. |
| getSize() | Gets the size. |
| toString() |
public Rectangle(double left, double top, double right, double bottom)
Initializes a new instance of the Rectangle class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| left | double | The x-coordinate of the left edge of the rectangular area. |
| top | double | The y-coordinate of the top edge of the rectangular area. |
| right | double | The x-coordinate of the right edge of the rectangular area. |
| bottom | double | The y-coordinate of the bottom edge of the rectangular area. |
public Rectangle(Point position, Size size)
Initializes a new instance of the Rectangle class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| position | Point | The coordinates of the upper-left corner of the rectangular area. |
| size | Size | The size of the rectangular area. |
public double getLeft()
Gets the x-coordinate of the left edge of the rectangular area.
Returns: double - A double value that represents the x-coordinate of the left edge of the rectangular area.
public double getTop()
Gets the y-coordinate of the top edge of the rectangular area.
Returns: double - A double value that represents the y-coordinate of the top edge of the rectangular area.
public double getRight()
Gets the x-coordinate of the right egde of the rectangular area.
Returns: double - A double value that represents the x-coordinate of the right edge of the rectangular area.
public double getBottom()
Gets the y-coordinate of the bottom edge of the rectangular area.
Returns: double - A double value that represents the y-coordinate of the bottom edge of the rectangular area.
public Point getPosition()
Gets the coordinates of the upper-left corner of the rectangular area.
Returns: Point - An instance of Point class that represents the coordinates of the upper-left corner of the rectangular area.
public Size getSize()
Gets the size.
Returns: Size - An instance of Size class that represents the size of the rectangular area.
public String toString()
Returns: java.lang.String
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.