Package org.jfree.ui
Class RectangleAnchor
- java.lang.Object
-
- org.jfree.ui.RectangleAnchor
-
- All Implemented Interfaces:
java.io.Serializable
public final class RectangleAnchor extends java.lang.Object implements java.io.Serializable
Used to indicate an anchor point for a rectangle.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static RectangleAnchor
BOTTOM
Bottom.static RectangleAnchor
BOTTOM_LEFT
Bottom-Left.static RectangleAnchor
BOTTOM_RIGHT
Bottom-Right.static RectangleAnchor
CENTER
Center.static RectangleAnchor
LEFT
Left.private java.lang.String
name
The name.static RectangleAnchor
RIGHT
Right.private static long
serialVersionUID
For serialization.static RectangleAnchor
TOP
Top.static RectangleAnchor
TOP_LEFT
Top-Left.static RectangleAnchor
TOP_RIGHT
Top-Right.
-
Constructor Summary
Constructors Modifier Constructor Description private
RectangleAnchor(java.lang.String name)
Private constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.awt.geom.Point2D
coordinates(java.awt.geom.Rectangle2D rectangle, RectangleAnchor anchor)
Returns the (x, y) coordinates of the specified anchor.static java.awt.geom.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)
.boolean
equals(java.lang.Object obj)
Returnstrue
if this object is equal to the specified object, andfalse
otherwise.int
hashCode()
Returns a hash code value for the object.private java.lang.Object
readResolve()
Ensures that serialization returns the unique instances.java.lang.String
toString()
Returns a string representing the object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
CENTER
public static final RectangleAnchor CENTER
Center.
-
TOP
public static final RectangleAnchor TOP
Top.
-
TOP_LEFT
public static final RectangleAnchor TOP_LEFT
Top-Left.
-
TOP_RIGHT
public static final RectangleAnchor TOP_RIGHT
Top-Right.
-
BOTTOM
public static final RectangleAnchor BOTTOM
Bottom.
-
BOTTOM_LEFT
public static final RectangleAnchor BOTTOM_LEFT
Bottom-Left.
-
BOTTOM_RIGHT
public static final RectangleAnchor BOTTOM_RIGHT
Bottom-Right.
-
LEFT
public static final RectangleAnchor LEFT
Left.
-
RIGHT
public static final RectangleAnchor RIGHT
Right.
-
name
private java.lang.String name
The name.
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a string representing the object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string.
-
equals
public boolean equals(java.lang.Object obj)
Returnstrue
if this object is equal to the specified object, andfalse
otherwise.- Overrides:
equals
in classjava.lang.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 classjava.lang.Object
- Returns:
- The hashcode
-
coordinates
public static java.awt.geom.Point2D coordinates(java.awt.geom.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 java.awt.geom.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 java.lang.Object readResolve() throws java.io.ObjectStreamException
Ensures that serialization returns the unique instances.- Returns:
- The object.
- Throws:
java.io.ObjectStreamException
- if there is a problem.
-
-