Class GroupLayout.Group
- Direct Known Subclasses:
GroupLayout.ParallelGroup, GroupLayout.SequentialGroup
- Enclosing class:
GroupLayout
Group provides the basis for the two types of
operations supported by GroupLayout: laying out
components one after another (SequentialGroup)
or aligned (ParallelGroup). Group and
its subclasses have no public constructor; to create one use
one of createSequentialGroup or
createParallelGroup. Additionally, taking a Group
created from one GroupLayout and using it with another
will produce undefined results.
Various methods in 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 DEFAULT_SIZE or PREFERRED_SIZE. A
value greater than or equal to 0 indicates a specific
size. DEFAULT_SIZE indicates the corresponding size
from the component should be used. For example, if
DEFAULT_SIZE is passed as the minimum size argument, the
minimum size is obtained from invoking getMinimumSize
on the component. Likewise, PREFERRED_SIZE indicates
the value from getPreferredSize should be used.
The following example adds myComponent to 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
myComponent to 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 myComponent.getPreferredSize and the maximum is
determined by invoking getMaximumSize on the component.
group.addComponent(myComponent, GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE);
Unless otherwise specified all the methods of Group and
its subclasses that allow you to specify a range throw an
IllegalArgumentException if passed an invalid range. An
invalid range is one in which any of the values are < 0 and
not one of PREFERRED_SIZE or DEFAULT_SIZE, or
the following is not met (for specific values): min
<= pref <= max.
Similarly any methods that take a Component throw a
IllegalArgumentException if passed null and any methods
that take a Group throw an NullPointerException if
passed null.
- Since:
- 1.6
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddComponent(Component component) Adds aComponentto thisGroup.addComponent(Component component, int min, int pref, int max) Adds aComponentto thisGroupwith the specified size.addGap(int size) Adds a rigid gap to thisGroup.addGap(int min, int pref, int max) Adds a gap to thisGroupwith the specified size.addGroup(GroupLayout.Group group) Adds aGroupto thisGroup.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Method Details
-
addGroup
Adds aGroupto thisGroup.- Parameters:
group- theGroupto add- Returns:
- this
Group
-
addComponent
Adds aComponentto thisGroup.- Parameters:
component- theComponentto add- Returns:
- this
Group
-
addComponent
Adds aComponentto thisGroupwith the specified size.- Parameters:
component- theComponentto addmin- the minimum size or one ofDEFAULT_SIZEorPREFERRED_SIZEpref- the preferred size or one ofDEFAULT_SIZEorPREFERRED_SIZEmax- the maximum size or one ofDEFAULT_SIZEorPREFERRED_SIZE- Returns:
- this
Group
-
addGap
Adds a rigid gap to thisGroup.- Parameters:
size- the size of the gap- Returns:
- this
Group - Throws:
IllegalArgumentException- ifsizeis less than0
-
addGap
Adds a gap to thisGroupwith the specified size.- Parameters:
min- the minimum size of the gappref- the preferred size of the gapmax- the maximum size of the gap- Returns:
- this
Group - Throws:
IllegalArgumentException- if any of the values are less than0
-