Rectangle
Inheritance: java.lang.Object
public class Rectangle
Represents a rectangular area.
Constructors
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. |
Methods
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() |
Rectangle(double left, double top, double right, double bottom)
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. |
Rectangle(Point position, Size size)
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. |
getLeft()
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.
getTop()
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.
getRight()
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.
getBottom()
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.
getPosition()
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.
getSize()
public Size getSize()
Gets the size.
Returns: Size - An instance of Size class that represents the size of the rectangular area.
toString()
public String toString()
Returns: java.lang.String