Class EdgeLayout

java.lang.Object
xal.tools.apputils.EdgeLayout
All Implemented Interfaces:
LayoutManager

public class EdgeLayout extends Object implements LayoutManager
EdgeLayout allows the developer a simpler mechanism for layout of components than the GridBagLayout without sacrificing powerful layout capability. The developer simply defines the behavior of motion for the component with respect to its parent and how the component grows. The motion is specified by struts between the edges of the the component and the corresponding edges of the parent container. For example, if you use a RIGHT strut, the component is bound to its parent's right edge according to the initial placement of the component. That is, the gap between the right edges of the parent and its container is preserved. If the component is bound left and right to its parent and the component is constrained to grow horizontally, the component will maintain the left and right gaps with its parent container and grow accordingly.
Author:
tap
  • Field Details

  • Constructor Details

    • EdgeLayout

      public EdgeLayout()
      Creates a new instance of SimpleLayout
  • Method Details

    • setConstraints

      public void setConstraints(Component component, int topStrut, int leftStrut, int bottomStrut, int rightStrut, int strutBehavior, int growBehavior)
      Add the component to the layout at the specified coordinates with the specified struts and strut and growth behaviors.
    • setConstraints

      public void setConstraints(Component component, int topStrut, int leftStrut, int bottomStrut, int rightStrut, int strutBehavior)
      Add the component to the layout at the specified coordinates with the specified struts and strut and no growth.
    • setConstraints

      public void setConstraints(Component component, Dimension containerSize, int x, int y, int strutBehavior, int growBehavior)
      Add the component to the layout at the specified coordinates with the specified strut and growth behaviors. The struts are calculated based on the component's preferred size and the specified container size.
    • setConstraints

      public void setConstraints(Component component, Dimension containerSize, int x, int y, int strutBehavior)
      Add the component to the layout at the specified coordinates with the specified strut and growth behaviors. The struts are calculated based on the component's preferred size and the specified container size.
    • add

      public void add(Component component, Container parent, int x, int y, int strutBehavior, int growBehavior)
      Add the component to the parent at the specified coordinates with the specified strut and growth behaviors. The struts are calculated based on the component's preferred size and the parent's bounds at the time this method is invoked.
    • add

      public void add(Component component, Container parent, int x, int y, int strutBehavior)
      Add the component to the parent at the specified coordinates with the specified strut behavior. The growth behavior is set to NO_GROWTH.
    • addLayoutComponent

      public void addLayoutComponent(String name, Component component)
      Implement LayoutManager interface
      Specified by:
      addLayoutComponent in interface LayoutManager
    • layoutContainer

      public void layoutContainer(Container parent)
      Implement LayoutManager interface
      Specified by:
      layoutContainer in interface LayoutManager
    • layoutComponent

      protected void layoutComponent(Component component, Container parent)
      Layout the component in the parent
    • minimumLayoutSize

      public Dimension minimumLayoutSize(Container parent)
      Implement LayoutManager interface
      Specified by:
      minimumLayoutSize in interface LayoutManager
    • preferredLayoutSize

      public Dimension preferredLayoutSize(Container parent)
      Implement LayoutManager interface
      Specified by:
      preferredLayoutSize in interface LayoutManager
    • removeLayoutComponent

      public void removeLayoutComponent(Component component)
      Implement LayoutManager interface
      Specified by:
      removeLayoutComponent in interface LayoutManager