- java.lang.Object
- 
- javax.swing.GroupLayout.Group
 
- 
- Direct Known Subclasses:
- GroupLayout.ParallelGroup,- GroupLayout.SequentialGroup
 - Enclosing class:
- GroupLayout
 
 public abstract class GroupLayout.Group extends Object Groupprovides the basis for the two types of operations supported byGroupLayout: laying out components one after another (SequentialGroup) or aligned (ParallelGroup).Groupand its subclasses have no public constructor; to create one use one ofcreateSequentialGrouporcreateParallelGroup. Additionally, taking aGroupcreated from oneGroupLayoutand using it with another will produce undefined results.Various methods in Groupand 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 ofDEFAULT_SIZEorPREFERRED_SIZE. A value greater than or equal to0indicates a specific size.DEFAULT_SIZEindicates the corresponding size from the component should be used. For example, ifDEFAULT_SIZEis passed as the minimum size argument, the minimum size is obtained from invokinggetMinimumSizeon the component. Likewise,PREFERRED_SIZEindicates the value fromgetPreferredSizeshould be used. The following example addsmyComponenttogroupwith 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 addsmyComponenttogroupusing a combination of the forms. The minimum size is forced to be the same as the preferred size, the preferred size is determined by usingmyComponent.getPreferredSizeand the maximum is determined by invokinggetMaximumSizeon the component.group.addComponent(myComponent, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE);Unless otherwise specified all the methods of Groupand its subclasses that allow you to specify a range throw anIllegalArgumentExceptionif passed an invalid range. An invalid range is one in which any of the values are < 0 and not one ofPREFERRED_SIZEorDEFAULT_SIZE, or the following is not met (for specific values):min<=pref<=max.Similarly any methods that take a Componentthrow aIllegalArgumentExceptionif passednulland any methods that take aGroupthrow anNullPointerExceptionif passednull.- Since:
- 1.6
- See Also:
- GroupLayout.createSequentialGroup(),- GroupLayout.createParallelGroup()
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description GroupLayout.GroupaddComponent(Component component)Adds aComponentto thisGroup.GroupLayout.GroupaddComponent(Component component, int min, int pref, int max)Adds aComponentto thisGroupwith the specified size.GroupLayout.GroupaddGap(int size)Adds a rigid gap to thisGroup.GroupLayout.GroupaddGap(int min, int pref, int max)Adds a gap to thisGroupwith the specified size.GroupLayout.GroupaddGroup(GroupLayout.Group group)Adds aGroupto thisGroup.
 
- 
- 
- 
Method Detail- 
addGrouppublic GroupLayout.Group addGroup(GroupLayout.Group group) Adds aGroupto thisGroup.- Parameters:
- group- the- Groupto add
- Returns:
- this Group
 
 - 
addComponentpublic GroupLayout.Group addComponent(Component component) Adds aComponentto thisGroup.- Parameters:
- component- the- Componentto add
- Returns:
- this Group
 
 - 
addComponentpublic GroupLayout.Group addComponent(Component component, int min, int pref, int max) Adds aComponentto thisGroupwith the specified size.- Parameters:
- component- the- Componentto add
- min- the minimum size or one of- DEFAULT_SIZEor- PREFERRED_SIZE
- pref- the preferred size or one of- DEFAULT_SIZEor- PREFERRED_SIZE
- max- the maximum size or one of- DEFAULT_SIZEor- PREFERRED_SIZE
- Returns:
- this Group
 
 - 
addGappublic GroupLayout.Group addGap(int size) Adds a rigid gap to thisGroup.- Parameters:
- size- the size of the gap
- Returns:
- this Group
- Throws:
- IllegalArgumentException- if- sizeis less than- 0
 
 - 
addGappublic GroupLayout.Group addGap(int min, int pref, int max) Adds a gap to thisGroupwith the specified size.- Parameters:
- min- the minimum size of the gap
- pref- the preferred size of the gap
- max- the maximum size of the gap
- Returns:
- this Group
- Throws:
- IllegalArgumentException- if any of the values are less than- 0
 
 
- 
 
-