Enum Class Alignment

java.lang.Object
java.lang.Enum<Alignment>
com.ardor3d.extension.ui.util.Alignment
All Implemented Interfaces:
Serializable, Comparable<Alignment>, Constable

public enum Alignment extends Enum<Alignment>
Enumeration useful for describing positioning and alignment to the edges and corners of a rectangular area. This is used in our UI system to align text, images, and handle certain layouts such as the AnchorLayout.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    South
    South West
    South East
    West
    Center
    East
    North
    North West
    North East
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    alignX(double availableWidth, double width)
    Determine the correct relative X position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "width").
    int
    alignX(int availableWidth, int width)
     
    double
    alignY(double availableHeight, double height)
    Determine the correct relative Y position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "height").
    int
    alignY(int availableHeight, int height)
     
    double
     
    double
     
    static Alignment
    Returns the enum constant of this class with the specified name.
    static Alignment[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • TOP_LEFT

      public static final Alignment TOP_LEFT
      North West
    • TOP

      public static final Alignment TOP
      North
    • TOP_RIGHT

      public static final Alignment TOP_RIGHT
      North East
    • LEFT

      public static final Alignment LEFT
      West
    • MIDDLE

      public static final Alignment MIDDLE
      Center
    • BOTTOM_LEFT

      public static final Alignment BOTTOM_LEFT
      South West
    • BOTTOM

      public static final Alignment BOTTOM
      South
    • BOTTOM_RIGHT

      public static final Alignment BOTTOM_RIGHT
      South East
  • Method Details

    • values

      public static Alignment[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Alignment valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromLeft

      public double fromLeft()
      Returns:
      a value in [0, 1] describing how far from the bottom this alignment is.
    • fromBottom

      public double fromBottom()
      Returns:
      a value in [0, 1] describing how far from the bottom this alignment is.
    • alignX

      public double alignX(double availableWidth, double width)
      Determine the correct relative X position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "width").
      Parameters:
      availableWidth - the width of the component or area we are aligning to.
      width - the width of the component or area we are setting position on.
      Returns:
      the new X position to use.
    • alignX

      public int alignX(int availableWidth, int width)
    • alignY

      public double alignY(double availableHeight, double height)
      Determine the correct relative Y position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "height").
      Parameters:
      availableHeight - the height of the component or area we are aligning to.
      height - the height of the component or area we are setting position on.
      Returns:
      the new Y position to use.
    • alignY

      public int alignY(int availableHeight, int height)