org.jfree.ui

Class RectangleAnchor

public final class RectangleAnchor extends Object implements Serializable

Used to indicate an anchor point for a rectangle.

Author: David Gilbert

Field Summary
static RectangleAnchorBOTTOM
Bottom.
static RectangleAnchorBOTTOM_LEFT
Bottom-Left.
static RectangleAnchorBOTTOM_RIGHT
Bottom-Right.
static RectangleAnchorCENTER
Center.
static RectangleAnchorLEFT
Left.
static RectangleAnchorRIGHT
Right.
static RectangleAnchorTOP
Top.
static RectangleAnchorTOP_LEFT
Top-Left.
static RectangleAnchorTOP_RIGHT
Top-Right.
Method Summary
static Point2Dcoordinates(Rectangle2D rectangle, RectangleAnchor anchor)
Returns the (x, y) coordinates of the specified anchor.
static Rectangle2DcreateRectangle(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).
booleanequals(Object obj)
Returns true if this object is equal to the specified object, and false otherwise.
inthashCode()
Returns a hash code value for the object.
StringtoString()
Returns a string representing the object.

Field Detail

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.

CENTER

public static final RectangleAnchor CENTER
Center.

LEFT

public static final RectangleAnchor LEFT
Left.

RIGHT

public static final RectangleAnchor RIGHT
Right.

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.

Method Detail

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.

equals

public boolean equals(Object obj)
Returns true if this object is equal to the specified object, and false otherwise.

Parameters: obj the other object (null permitted).

Returns: A boolean.

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns: The hashcode

toString

public String toString()
Returns a string representing the object.

Returns: The string.