Home » openjdk-7 » javax » swing » [javadoc | source]
javax.swing
abstract public class: GroupLayout.Group [javadoc | source]
java.lang.Object
   javax.swing.GroupLayout.Spring
      javax.swing.GroupLayout$Group

Direct Known Subclasses:
    SequentialGroup, BaselineGroup, ParallelGroup

{@code Group} provides the basis for the two types of operations supported by {@code GroupLayout}: laying out components one after another (SequentialGroup ) or aligned (ParallelGroup ). {@code Group} and its subclasses have no public constructor; to create one use one of {@code createSequentialGroup} or {@code createParallelGroup}. Additionally, taking a {@code Group} created from one {@code GroupLayout} and using it with another will produce undefined results.

Various methods in {@code Group} and its subclasses allow you to explicitly specify the range. The arguments to these methods can take two forms, either a value greater than or equal to 0, or one of {@code DEFAULT_SIZE} or {@code PREFERRED_SIZE}. A value greater than or equal to {@code 0} indicates a specific size. {@code DEFAULT_SIZE} indicates the corresponding size from the component should be used. For example, if {@code DEFAULT_SIZE} is passed as the minimum size argument, the minimum size is obtained from invoking {@code getMinimumSize} on the component. Likewise, {@code PREFERRED_SIZE} indicates the value from {@code getPreferredSize} should be used. The following example adds {@code myComponent} to {@code group} with specific values for the range. That is, the minimum is explicitly specified as 100, preferred as 200, and maximum as 300.

  group.addComponent(myComponent, 100, 200, 300);
The following example adds {@code myComponent} to {@code group} using a combination of the forms. The minimum size is forced to be the same as the preferred size, the preferred size is determined by using {@code myComponent.getPreferredSize} and the maximum is determined by invoking {@code getMaximumSize} on the component.
  group.addComponent(myComponent, GroupLayout.PREFERRED_SIZE,
            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE);

Unless otherwise specified all the methods of {@code Group} and its subclasses that allow you to specify a range throw an {@code IllegalArgumentException} if passed an invalid range. An invalid range is one in which any of the values are < 0 and not one of {@code PREFERRED_SIZE} or {@code DEFAULT_SIZE}, or the following is not met (for specific values): {@code min} <= {@code pref} <= {@code max}.

Similarly any methods that take a {@code Component} throw a {@code IllegalArgumentException} if passed {@code null} and any methods that take a {@code Group} throw an {@code NullPointerException} if passed {@code null}.

Field Summary
 List<Spring> springs     
Constructor:
 Group() 
Method from javax.swing.GroupLayout$Group Summary:
addComponent,   addComponent,   addGap,   addGap,   addGroup,   addSpring,   calculateAutopadding,   calculateMaximumSize,   calculateMinimumSize,   calculatePreferredSize,   calculateSize,   getSpring,   getSpringSize,   indexOf,   insertAutopadding,   operator,   removeAutopadding,   setSize,   setValidSize,   unsetAutopadding,   willHaveZeroSize
Methods from javax.swing.GroupLayout$Spring:
calculateMaximumSize,   calculateMinimumSize,   calculatePreferredSize,   constrain,   getAlignment,   getBaseline,   getBaselineResizeBehavior,   getMaximumSize,   getMinimumSize,   getParent,   getPreferredSize,   getSize,   isResizable,   setAlignment,   setParent,   setSize,   unset,   willHaveZeroSize
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.GroupLayout$Group Detail:
 public Group addComponent(Component component) 
    Adds a {@code Component} to this {@code Group}.
 public Group addComponent(Component component,
    int min,
    int pref,
    int max) 
    Adds a {@code Component} to this {@code Group} with the specified size.
 public Group addGap(int size) 
    Adds a rigid gap to this {@code Group}.
 public Group addGap(int min,
    int pref,
    int max) 
    Adds a gap to this {@code Group} with the specified size.
 public Group addGroup(Group group) 
    Adds a {@code Group} to this {@code Group}.
 Group addSpring(Spring spring) 
    Adds the Spring to the list of {@code Spring}s and returns the receiver.
  void calculateAutopadding(int axis) 
 int calculateMaximumSize(int axis) 
 int calculateMinimumSize(int axis) 
 int calculatePreferredSize(int axis) 
 int calculateSize(int axis,
    int type) 
    Calculates the specified size. This is called from one of the {@code getMinimumSize0}, {@code getPreferredSize0} or {@code getMaximumSize0} methods. This will invoke to {@code operator} to combine the values.
 Spring getSpring(int index) 
 int getSpringSize(Spring spring,
    int axis,
    int type) 
 int indexOf(Spring spring) 
 abstract  void insertAutopadding(int axis,
    List<AutoPreferredGapSpring> leadingPadding,
    List<AutoPreferredGapSpring> trailingPadding,
    List<ComponentSpring> leading,
    List<ComponentSpring> trailing,
    boolean insert)
    Adjusts the autopadding springs in this group and its children. If {@code insert} is true this will insert auto padding springs, otherwise this will only adjust the springs that comprise auto preferred padding springs.
 abstract int operator(int a,
    int b)
    Used to compute how the two values representing two springs will be combined. For example, a group that layed things out one after the next would return {@code a + b}.
  void removeAutopadding() 
    Removes any AutopaddingSprings for this Group and its children.
  void setSize(int axis,
    int origin,
    int size) 
 abstract  void setValidSize(int axis,
    int origin,
    int size)
    This is invoked from {@code setSize} if passed a value other than UNSET.
  void unsetAutopadding() 
 boolean willHaveZeroSize(boolean treatAutopaddingAsZeroSized)