public class Anchor extends Object
| Modifier and Type | Field and Description |
|---|---|
static Anchor |
BOTTOM_LEFT
Convenient anchor representing a point at the bottom left hand corner.
|
static Anchor |
BOTTOM_RIGHT
Convenient anchor representing a point at the bottom right hand corner.
|
static Anchor |
CENTER
Convenient anchor representing a point at the center.
|
static Anchor |
CENTER_BOTTOM
Convenient anchor representing a point at the center of the bottom edge.
|
static Anchor |
CENTER_LEFT
Convenient anchor representing a point at the center of the right edge.
|
static Anchor |
CENTER_RIGHT
Convenient anchor representing a point at the center of the right edge.
|
static Anchor |
CENTER_TOP
Convenient anchor representing a point at the center of the top edge.
|
static Anchor |
TOP_LEFT
Convenient anchor representing a point at the top left hand corner.
|
static Anchor |
TOP_RIGHT
Convenient anchor representing a point at the top right hand corner.
|
| Constructor and Description |
|---|
Anchor(Anchor anchor)
Constructor specifying an anchor to copy from.
|
Anchor(float relativeX,
float relativeY)
Anchor specifying the relative positions on the X axis and Y axis.
|
Anchor(float relativeX,
int offsetX,
float relativeY,
int offsetY)
Anchor specifying the relative positions and offsets on the X axis and Y axis.
|
| Modifier and Type | Method and Description |
|---|---|
Point |
getAnchorPoint(Dimension size)
Retrieves a point on an object of the specified size.
|
Point |
getAnchorPoint(int width,
int height)
Retrieves a point on an object of the specified size.
|
int |
getOffsetX()
Gets the offset in pixels on the X axis, relatively to
relativeX. |
int |
getOffsetY()
Gets the offset in pixels on the Y axis, relatively to
relativeY. |
float |
getRelativeX()
Gets the relative position in percentage relatively to the origin and length on the X axis.
|
float |
getRelativeY()
Gets the relative position in percentage relatively to the origin and length on the Y axis.
|
public static final Anchor TOP_LEFT
public static final Anchor TOP_RIGHT
public static final Anchor BOTTOM_LEFT
public static final Anchor BOTTOM_RIGHT
public static final Anchor CENTER_TOP
public static final Anchor CENTER_BOTTOM
public static final Anchor CENTER_LEFT
public static final Anchor CENTER_RIGHT
public static final Anchor CENTER
public Anchor(Anchor anchor)
anchor - Anchor to copy from.public Anchor(float relativeX,
float relativeY)
public Anchor(float relativeX,
int offsetX,
float relativeY,
int offsetY)
public float getRelativeX()
public float getRelativeY()
public int getOffsetX()
relativeX.public int getOffsetY()
relativeY.public Point getAnchorPoint(Dimension size)
size - Size of the object to get the anchor point for.getAnchorPoint(int, int)public Point getAnchorPoint(int width, int height)
width - Width of the object to get the anchor point for.height - Height of the object to get the anchor point for.getAnchorPoint(Dimension)Copyright © 2015. All Rights Reserved.