Class Rectangle


  • public class Rectangle
    extends java.lang.Object
    Represents the position and size of a rectangle in application units.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double height
      The height of the rectangle.
      double width
      The width of the rectangle.
      double x
      The left edge.
      double y
      The top edge.
    • Constructor Summary

      Constructors 
      Constructor Description
      Rectangle()
      Default constructor.
      Rectangle​(double x, double y, double height, double width)
      Constructor.
      Rectangle​(Point posn, Point size)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Point getPosition()
      Returns the position of the top left corner.
      Point getSize()
      Returns the rectangle size.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • x

        public double x
        The left edge.
      • y

        public double y
        The top edge.
      • width

        public double width
        The width of the rectangle.
      • height

        public double height
        The height of the rectangle.
    • Constructor Detail

      • Rectangle

        public Rectangle()
        Default constructor.
      • Rectangle

        public Rectangle​(double x,
                         double y,
                         double height,
                         double width)
        Constructor.
        Parameters:
        x - left edge
        y - top edge
        height - rectangle height
        width - rectangle width
      • Rectangle

        public Rectangle​(Point posn,
                         Point size)
        Constructor.
        Parameters:
        posn - position of top left corner
        size - size of the rectangle
    • Method Detail

      • getPosition

        public Point getPosition()
        Returns the position of the top left corner.
        Returns:
        position of the top left corner
      • getSize

        public Point getSize()
        Returns the rectangle size.
        Returns:
        rectangle size