Class Rectangle


  • public class Rectangle
    extends java.lang.Object
    Represents an area of the screen.
    • Constructor Summary

      Constructors 
      Constructor Description
      Rectangle​(int x1, int y1, int x2, int y2)
      Instantiates a new Rectangle.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Point bottomRight()
      Get a Point representing the location of the top left corner of the Rectangle.
      boolean equals​(java.lang.Object other)  
      int hashCode()  
      Point topLeft()
      Get a Point representing the location of the top left corner of the Rectangle.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Rectangle

        public Rectangle​(int x1,
                         int y1,
                         int x2,
                         int y2)
        Instantiates a new Rectangle.
        Parameters:
        x1 - the x coordinate of the top left corner
        y1 - the y coordinate of the top left corner
        x2 - the x coordinate of the bottom right corner
        y2 - the y coordinate of the bottom right corner
    • Method Detail

      • topLeft

        public Point topLeft()
        Get a Point representing the location of the top left corner of the Rectangle.
        Returns:
        the point
      • bottomRight

        public Point bottomRight()
        Get a Point representing the location of the top left corner of the Rectangle.
        Returns:
        the point
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object