Class Rectangle

java.lang.Object
com.vaadin.featurepack.desktop.geometry.Rectangle
All Implemented Interfaces:
Serializable

public class Rectangle extends Object implements Serializable
A class that represents a rectangle in 2D space.
Author:
Vaadin Ltd
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new rectangle with coordinates (0, 0) and size 0x0.
    Rectangle(int x, int y, int width, int height)
    Creates a new rectangle with the given coordinates and size.
    Creates a new rectangle from a Point and Dimension objects.
    Creates a new rectangle clone of another Rectangle
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Returns the height of the rectangle.
    Returns the location of this rectangle.
    Returns the size of this rectangle.
    int
    Returns the width of the rectangle.
    int
    Returns the x coordinate of the left side of the rectangle.
    int
    Returns the y coordinate of the top side of the rectangle.
    int
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Rectangle

      public Rectangle()
      Creates a new rectangle with coordinates (0, 0) and size 0x0.
    • Rectangle

      public Rectangle(int x, int y, int width, int height)
      Creates a new rectangle with the given coordinates and size.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      width - the width
      height - the height
    • Rectangle

      public Rectangle(Point p, Dimension d)
      Creates a new rectangle from a Point and Dimension objects.
      Parameters:
      p - the Point object representing the location
      d - the Dimension object representing the size
    • Rectangle

      public Rectangle(Rectangle r)
      Creates a new rectangle clone of another Rectangle
      Parameters:
      Rectangle - the Rectangle to clone
  • Method Details

    • getLocation

      public Point getLocation()
      Returns the location of this rectangle.
      Returns:
      the location
    • getSize

      public Dimension getSize()
      Returns the size of this rectangle.
      Returns:
      the size
    • getX

      public int getX()
      Returns the x coordinate of the left side of the rectangle.
      Returns:
      the x coordinate
    • getY

      public int getY()
      Returns the y coordinate of the top side of the rectangle.
      Returns:
      the y coordinate
    • getWidth

      public int getWidth()
      Returns the width of the rectangle.
      Returns:
      the width
    • getHeight

      public int getHeight()
      Returns the height of the rectangle.
      Returns:
      the height
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object