Class AnchorLayout

java.lang.Object
com.ardor3d.extension.ui.layout.UILayout
com.ardor3d.extension.ui.layout.AnchorLayout

public class AnchorLayout extends UILayout

This layout arranges components based on anchors - descriptions of hard connections between two components. These connections are specified per component, where each component may specify a dependent relationship with exactly one other component. Each relationship consists of the two dependent components, the alignment points on each, and optional x/y offsets.

As an example, the following would setup labelA in the top left corner of the container, 5 pixels from the top and 5 pixels from the bottom. Directly below that (5 pixels from the bottom of labelA) is labelB, left aligned to labelA:
 UIContainer container;
 UILabel labelA, labelB

 ...

 container.setLayout(new AnchorLayout());
 labelA.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, container, Alignment.TOP_LEFT, 5, -5));
 labelB.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, labelA, Alignment.BOTTOM_LEFT, 0, -5));
 
See Also:
  • Constructor Details

    • AnchorLayout

      public AnchorLayout()
  • Method Details

    • layoutContents

      public void layoutContents(UIContainer container)
      Description copied from class: UILayout
      Perform the actual layout of the contents in the given container.
      Specified by:
      layoutContents in class UILayout
      Parameters:
      container - the container to layout
    • updateMinimumSizeFromContents

      public void updateMinimumSizeFromContents(UIContainer container)
      Description copied from class: UILayout
      Update the minimum size of this container, based on the contents of the provided container and this layout.
      Specified by:
      updateMinimumSizeFromContents in class UILayout
      Parameters:
      container - the container to update