Package com.github.weisj.darklaf.util
Enum Alignment
- java.lang.Object
-
- java.lang.Enum<Alignment>
-
- com.github.weisj.darklaf.util.Alignment
-
- All Implemented Interfaces:
Serializable,Comparable<Alignment>
public enum Alignment extends Enum<Alignment>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CENTEREASTNORTHNORTH_EASTNORTH_WESTSOUTHSOUTH_EASTSOUTH_WESTWEST
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PointalignInside(Dimension toAlign, Rectangle outerBounds)Align Rectangle inside other rectangle with respect to the alignment.PointalignOutside(Dimension toAlign, Rectangle innerBounds)Align Rectangle outside other rectangle with respect to the alignment.Alignmentanticlockwise()booleancanBeAligned(Point point, Dimension size, Rectangle outerBounds)Check whether the given Rectangle can be aligned at point inside boundaries.Alignmentclockwise()static AlignmentgetAlignment(Point point, Dimension size, Rectangle outerBounds, Alignment hint)Get fitting alignment.doublegetAngle()intgetDegreeAngle()intgetIndex()Get the index of the alignment.booleanisDiagonal()booleanisEast()booleanisEast(boolean includePure)booleanisHorizontal()booleanisNorth()booleanisSouth()booleanisVertical()booleanisWest()booleanisWest(boolean includePure)InsetsmaskInsets(int top, int left, int bottom, int right, int mask)InsetsmaskInsets(Insets insets)InsetsmaskInsets(Insets insets, int maskValue)InsetsmaskInsetsInverted(int top, int left, int bottom, int right, int mask)InsetsmaskInsetsInverted(Insets insets)InsetsmaskInsetsInverted(Insets insets, int mask)Alignmentopposite()Get the opposite alignment.PointrelativePos(Dimension toAlign, Point alignAt)Get the relative Position of Rectangle to Point with respect to the alignment.static AlignmentvalueOf(String name)Returns 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 Detail
-
NORTH
public static final Alignment NORTH
-
SOUTH
public static final Alignment SOUTH
-
EAST
public static final Alignment EAST
-
WEST
public static final Alignment WEST
-
NORTH_EAST
public static final Alignment NORTH_EAST
-
NORTH_WEST
public static final Alignment NORTH_WEST
-
SOUTH_EAST
public static final Alignment SOUTH_EAST
-
SOUTH_WEST
public static final Alignment SOUTH_WEST
-
CENTER
public static final Alignment CENTER
-
-
Method Detail
-
values
public static Alignment[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Alignment c : Alignment.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Alignment valueOf(String name)
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
public boolean canBeAligned(Point point, Dimension size, Rectangle outerBounds)
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
public Point relativePos(Dimension toAlign, Point alignAt)
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
public Point alignOutside(Dimension toAlign, Rectangle innerBounds)
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
public Alignment opposite()
Get the opposite alignment.- Returns:
- Alignment opposite on the compass.
-
anticlockwise
public Alignment anticlockwise()
-
clockwise
public Alignment clockwise()
-
maskInsets
public Insets maskInsets(int top, int left, int bottom, int right, int mask)
-
maskInsetsInverted
public Insets maskInsetsInverted(int top, int left, int bottom, int right, int mask)
-
alignInside
public Point alignInside(Dimension toAlign, Rectangle outerBounds)
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 includePure)
-
isWest
public boolean isWest(boolean includePure)
-
isVertical
public boolean isVertical()
-
isHorizontal
public boolean isHorizontal()
-
isDiagonal
public boolean isDiagonal()
-
getAngle
public double getAngle()
-
getDegreeAngle
public int getDegreeAngle()
-
-