| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public abstract class GroupLayout.Group extends GroupLayout.Spring
{@code Group} provides the basis for the two types of operations supported by {@code GroupLayout}: laying out components one after another ({@link SequentialGroup SequentialGroup}) or aligned ({@link ParallelGroup 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 NullPointerException} if passed {@code null} and any methods that take a {@code Group} throw an {@code IllegalArgumentException} if passed {@code null}.
Method Summary | |
---|---|
GroupLayout.Group |
addComponent(Component component) Adds a to this . |
GroupLayout.Group |
addComponent(Component component, int min, int pref, int max) Adds a to this with the specified size. |
GroupLayout.Group |
addGap(int size) Adds a rigid gap to this . |
GroupLayout.Group |
addGap(int min, int pref, int max) Adds a gap to this with the specified size. |
GroupLayout.Group |
addGroup(GroupLayout.Group group) Adds a to this . |
Method Detail |
---|
public GroupLayout.Group addComponent(Component component)
component
- the {@code Component} to addpublic GroupLayout.Group addComponent(Component component, int min, int pref, int max)
component
- the {@code Component} to addmin
- the minimum size or one of {@code DEFAULT_SIZE} or
{@code PREFERRED_SIZE}pref
- the preferred size or one of {@code DEFAULT_SIZE} or
{@code PREFERRED_SIZE}max
- the maximum size or one of {@code DEFAULT_SIZE} or
{@code PREFERRED_SIZE}public GroupLayout.Group addGap(int size)
size
- the size of the gappublic GroupLayout.Group addGap(int min, int pref, int max)
min
- the minimum size of the gappref
- the preferred size of the gapmax
- the maximum size of the gappublic GroupLayout.Group addGroup(GroupLayout.Group group)
group
- the {@code Group} to add
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |