Package com.github.weisj.darklaf.util
Enum Alignment
- All Implemented Interfaces:
Serializable,Comparable<Alignment>,java.lang.constant.Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionalignInside(Dimension toAlign, Rectangle outerBounds)Align Rectangle inside other rectangle with respect to the alignment.alignOutside(Dimension toAlign, Rectangle innerBounds)Align Rectangle outside other rectangle with respect to the alignment.booleancanBeAligned(Point point, Dimension size, Rectangle outerBounds)Check whether the given Rectangle can be aligned at point inside boundaries.static AlignmentgetAlignment(Point point, Dimension size, Rectangle outerBounds, Alignment hint)Get fitting alignment.doublegetAngle()intintgetIndex()Get the index of the alignment.booleanbooleanisEast()booleanisEast(boolean includePureDirections)booleanbooleanisNorth()booleanisSouth()booleanbooleanisWest()booleanisWest(boolean includePureDirections)maskInsets(int top, int left, int bottom, int right, int mask)maskInsets(Insets insets)maskInsets(Insets insets, int maskValue)maskInsetsInverted(int top, int left, int bottom, int right, int mask)maskInsetsInverted(Insets insets)maskInsetsInverted(Insets insets, int mask)opposite()Get the opposite alignment.relativePos(Dimension toAlign, Point alignAt)Get the relative Position of Rectangle to Point with respect to the alignment.static AlignmentReturns the enum constant of this type with the specified name.static Alignment[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NORTH
-
SOUTH
-
EAST
-
WEST
-
NORTH_EAST
-
NORTH_WEST
-
SOUTH_EAST
-
SOUTH_WEST
-
CENTER
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getAlignment
public static Alignment getAlignment(Point point, Dimension size, Rectangle outerBounds, Alignment hint)Get fitting alignment.- Parameters:
point- point to align at.size- Size of rectangle to align.outerBounds- outer boundaries to align in.hint- preferred alignment.- Returns:
- fitting alignment. If none is found the default is
CENTER.
-
canBeAligned
Check whether the given Rectangle can be aligned at point inside boundaries.- Parameters:
point- point to align at.size- size of rectangle to align.outerBounds- boundaries.- Returns:
- true if can be aligned.
-
relativePos
Get the relative Position of Rectangle to Point with respect to the alignment.- Parameters:
toAlign- size of Rectangle to align.alignAt- point to align at.- Returns:
- top/left position of aligned rectangle
-
alignOutside
Align Rectangle outside other rectangle with respect to the alignment.- Parameters:
toAlign- size of rectangle to aligninnerBounds- bounds of inside rectangle- Returns:
- top/left point of aligned rectangle
-
getIndex
public int getIndex()Get the index of the alignment. This function is for utility purposes where one might save settings based on alignment in an array.- Returns:
- the index.
-
opposite
Get the opposite alignment.- Returns:
- Alignment opposite on the compass.
-
anticlockwise
-
clockwise
-
maskInsets
-
maskInsets
-
maskInsets
-
maskInsetsInverted
-
maskInsetsInverted
-
maskInsetsInverted
-
alignInside
Align Rectangle inside other rectangle with respect to the alignment.- Parameters:
toAlign- size of rectangle to alignouterBounds- bounds of outer rectangle- Returns:
- top/left point of aligned rectangle
-
isNorth
public boolean isNorth() -
isSouth
public boolean isSouth() -
isEast
public boolean isEast() -
isWest
public boolean isWest() -
isEast
public boolean isEast(boolean includePureDirections) -
isWest
public boolean isWest(boolean includePureDirections) -
isVertical
public boolean isVertical() -
isHorizontal
public boolean isHorizontal() -
isDiagonal
public boolean isDiagonal() -
getAngle
public double getAngle() -
getDegreeAngle
public int getDegreeAngle()
-