Module org.autogui

Class ResizableFlowLayout

java.lang.Object
org.autogui.swing.util.ResizableFlowLayout
All Implemented Interfaces:
LayoutManager

public class ResizableFlowLayout extends Object implements LayoutManager
a layout manager for lining up components horizontally or vertically.
      orientation = true; //horizontal
      [comp1] [comp2] ...
  
      orientation = false; //vertical
      [comp1]
      [comp2]
      ...
  

Width or height of each component can be resizable or fixed. If the size is fixed, the manager refers preferred size and minimum size of a component.

To manage components, it needs to manually add them to the manager. add(Container, Component, boolean) is the convenient method for the task.

       JPanel pane = new JPanel();
       ResizableFlowLayout layout = new ResizableFlowLayout(true); //horizontal
       pane.setLayout(layout);

       ResizableFlowLayout.add(pane, new JLabel("Message:"), false); //fixed
       ResizableFlowLayout.add(pane, new JTextField(""), true);  //resizable
   

ResizableFlowLayout.LayoutAppender is a factory for creating a pane with the layout. It can be created by create(boolean).

        JPanel pane = ResizableFlowLayout.create(false) //vertical
          .add(ResizableFlowLayout.create(true)
                  .add(new JLabel("Message:")).add(new JTextField(""), true).getContainer())
          .add(ResizableFlowLayout.create(true)
                  .add(new JLabel("Name:")).add(new JTextField(""), true).getContainer())
          .getContainer();
    
  • Field Details

    • margin

      protected int margin
    • orientation

      protected boolean orientation
    • fitHeight

      protected boolean fitHeight
    • resizable

      protected Set<Component> resizable
  • Constructor Details

    • ResizableFlowLayout

      public ResizableFlowLayout(boolean horizontalOrientation, int margin)
    • ResizableFlowLayout

      public ResizableFlowLayout(boolean horizontalOrientation)
  • Method Details