Package org.jfree.ui

Class RectangleAnchor

java.lang.Object
org.jfree.ui.RectangleAnchor
All Implemented Interfaces:
Serializable

public final class RectangleAnchor extends Object implements Serializable
Used to indicate an anchor point for a rectangle.
See Also:
  • Field Details

  • Constructor Details

    • RectangleAnchor

      private RectangleAnchor(String name)
      Private constructor.
      Parameters:
      name - the name.
  • Method Details

    • toString

      public String toString()
      Returns a string representing the object.
      Overrides:
      toString in class Object
      Returns:
      The string.
    • equals

      public boolean equals(Object obj)
      Returns true if this object is equal to the specified object, and false otherwise.
      Overrides:
      equals in class Object
      Parameters:
      obj - the other object (null permitted).
      Returns:
      A boolean.
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
      Returns:
      The hashcode
    • coordinates

      public static Point2D coordinates(Rectangle2D rectangle, RectangleAnchor anchor)
      Returns the (x, y) coordinates of the specified anchor.
      Parameters:
      rectangle - the rectangle.
      anchor - the anchor.
      Returns:
      The (x, y) coordinates.
    • createRectangle

      public static Rectangle2D createRectangle(Size2D dimensions, double anchorX, double anchorY, RectangleAnchor anchor)
      Creates a new rectangle with the specified dimensions that is aligned to the given anchor point (anchorX, anchorY).
      Parameters:
      dimensions - the dimensions (null not permitted).
      anchorX - the x-anchor.
      anchorY - the y-anchor.
      anchor - the anchor (null not permitted).
      Returns:
      A rectangle.
    • readResolve

      private Object readResolve() throws ObjectStreamException
      Ensures that serialization returns the unique instances.
      Returns:
      The object.
      Throws:
      ObjectStreamException - if there is a problem.