Class Anchor2D
Represents a point in a rectangle as a ratio of this rectangle's width and height.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleDefines the x axis where the left is 0, the right is 1 and the middle is 0.5.doubleDefines the y axis where the top is 0, the bottom is 1 and the middle is 0.5. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Anchor2Dbottom()Returns an anchor positioned at the bottom center.static Anchor2DReturns an anchor positioned at the bottom left.static Anchor2DReturns an anchor positioned at the bottom right.static Anchor2Dcenter()Returns an anchor positioned at the center.booleaninthashCode()static Anchor2Dleft()Returns an anchor positioned at the left center.static Anchor2Dright()Returns an anchor positioned at the right center.static Anchor2Dtop()Returns an anchor positioned at the top center.static Anchor2DtopLeft()Returns an anchor positioned at the top left.static Anchor2DtopRight()Returns an anchor positioned at the top right.
-
Field Details
-
horizontal
public double horizontalDefines the x axis where the left is 0, the right is 1 and the middle is 0.5. The default value is 0.5.
-
vertical
public double verticalDefines the y axis where the top is 0, the bottom is 1 and the middle is 0.5. The default value is 0.5.
-
-
Constructor Details
-
Anchor2D
public Anchor2D()Creates a new instance of an Anchor2D with the default parameters
-
Anchor2D
public Anchor2D(double horizontal, double vertical) Creates a new instance of an Anchor2D.
- Parameters:
horizontal-Defines the x axis where the left is 0, the right is 1 and the middle is 0.5.
vertical-Defines the y axis where the top is 0, the bottom is 1 and the middle is 0.5.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
center
Returns an anchor positioned at the center.
- Returns:
An Anchor2D at (0.5, 0.5).
-
top
Returns an anchor positioned at the top center.
- Returns:
An Anchor2D at (0.5, 0.0).
-
topRight
Returns an anchor positioned at the top right.
- Returns:
An Anchor2D at (1.0, 0.0).
-
right
Returns an anchor positioned at the right center.
- Returns:
An Anchor2D at (1.0, 0.5).
-
bottomRight
Returns an anchor positioned at the bottom right.
- Returns:
An Anchor2D at (1.0, 1.0).
-
bottom
Returns an anchor positioned at the bottom center.
- Returns:
An Anchor2D at (0.5, 1.0).
-
bottomLeft
Returns an anchor positioned at the bottom left.
- Returns:
An Anchor2D at (0.0, 1.0).
-
left
Returns an anchor positioned at the left center.
- Returns:
An Anchor2D at (0.0, 0.5).
-
topLeft
Returns an anchor positioned at the top left.
- Returns:
An Anchor2D at (0.0, 0.0).
-