Class Rectangle.WithMonitor

All Implemented Interfaces:
Serializable, Cloneable
Enclosing class:
Rectangle

public static final class Rectangle.WithMonitor extends Rectangle.OfFloat
Instances of this class represent Rectangle.OfFloat objects along with the context of the monitor in relation to which they are placed on the display. The monitor awareness makes it easy to scale and translate the rectangles between pixels and points.
Since:
3.131
See Also:
Restriction:
This class is not intended to be referenced by clients
  • Constructor Details

    • WithMonitor

      public WithMonitor(int x, int y, int width, int height, Monitor monitor)
      Constructs a new Rectangle.WithMonitor
      Parameters:
      x - the x coordinate of the top left corner of the rectangle
      y - the y coordinate of the top left corner of the rectangle
      width - the width of the rectangle
      height - the height of the rectangle
      monitor - the monitor with whose context the rectangle is created
  • Method Details

    • getMonitor

      public Monitor getMonitor()
      Returns the monitor with whose context the instance is created.
      Returns:
      the monitor with whose context the instance is created
    • clone

      public Rectangle.WithMonitor clone()
      Description copied from class: Rectangle
      Creates and returns a copy of this Rectangle.

      This method performs a shallow copy of the rectangle's fields: x, y, width, and height. It does not copy any subclass-specific fields, so subclasses should override this method if additional fields exist.

      Overrides:
      clone in class Rectangle
      Returns:
      a new Rectangle instance with the same position and size as this one