Package com.j3d.gen.guide
Class Anchor
java.lang.Object
com.j3d.gen.guide.Anchor
Positioning bitmasks for
GuideInfo and GuidePanelAdapter.
These are just quick positioning rather than having to do coordinate calculations yourself.
Used in GuideInfo.addCompAt(GuidePanelAdapter, Component, int) and
GuideInfo.addCompAt(GuidePanelAdapter, Component, int, int, int) since offsets might still
be needed.
- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRepresents the center anchor position.static final intRepresents the east (right) anchor position.static final intRepresents the north (top) anchor position.static final intRepresents the south (bottom) anchor position.static final intRepresents the west (left) anchor position. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhas(int value, int bit) Checks if a given combined anchor value contains a specific anchor bit.static booleanhasHorizontal(int value) static booleanhasVertical(int value) static intoffsetDown(int i) Creates a downward component offset of the given magnitude.static intoffsetLeft(int i) Creates a leftward component offset of the given magnitude.static intoffsetRight(int i) Creates a rightward component offset of the given magnitude.static intoffsetUp(int i) Creates an upward component offset of the given magnitude.
-
Field Details
-
CENTRE
public static final int CENTRERepresents the center anchor position.- See Also:
-
NORTH
public static final int NORTHRepresents the north (top) anchor position.- See Also:
-
SOUTH
public static final int SOUTHRepresents the south (bottom) anchor position.- See Also:
-
EAST
public static final int EASTRepresents the east (right) anchor position.- See Also:
-
WEST
public static final int WESTRepresents the west (left) anchor position.- See Also:
-
-
Constructor Details
-
Anchor
public Anchor()
-
-
Method Details
-
has
public static boolean has(int value, int bit) Checks if a given combined anchor value contains a specific anchor bit. This is useful for determining if a particular direction or center is part of the specified positioning.- Parameters:
value- The combined anchor value (e.g.,NORTH | EAST).bit- The specific anchor bit to check for (e.g.,NORTH).- Returns:
trueif thevaluecontains thebit,falseotherwise.
-
hasVertical
public static boolean hasVertical(int value) -
hasHorizontal
public static boolean hasHorizontal(int value) -
offsetUp
public static int offsetUp(int i) Creates an upward component offset of the given magnitude.- Parameters:
i- distance from anchor in pixels- Returns:
- the offset magnitude
-
offsetDown
public static int offsetDown(int i) Creates a downward component offset of the given magnitude.- Parameters:
i- distance from anchor in pixels- Returns:
- the offset magnitude
-
offsetRight
public static int offsetRight(int i) Creates a rightward component offset of the given magnitude.- Parameters:
i- distance from the anchor in pixels- Returns:
- the offset magnitude
-
offsetLeft
public static int offsetLeft(int i) Creates a leftward component offset of the given magnitude.- Parameters:
i- distance from the anchor in pixels- Returns:
- the offset magnitude
-