Class GroupLayout.SequentialGroup
java.lang.Object
javax.swing.GroupLayout.Group
javax.swing.GroupLayout.SequentialGroup
- Enclosing class:
GroupLayout
A
Group that positions and sizes its elements
sequentially, one after another. This class has no public
constructor, use the createSequentialGroup method
to create one.
In order to align a SequentialGroup along the baseline
of a baseline aligned ParallelGroup you need to specify
which of the elements of the SequentialGroup is used to
determine the baseline. The element used to calculate the
baseline is specified using one of the add methods that
take a boolean. The last element added with a value of
true for useAsBaseline is used to calculate the
baseline.
- Since:
- 1.6
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddComponent(boolean useAsBaseline, Component component) Adds aComponentto thisGroup.addComponent(boolean useAsBaseline, Component component, int min, int pref, int max) Adds aComponentto thisGroupwith the specified size.addComponent(Component component) Adds aComponentto thisGroup.addComponent(Component component, int min, int pref, int max) Adds aComponentto thisGroupwith the specified size.Adds an element representing the preferred gap between an edge the container and components that touch the border of the container.addContainerGap(int pref, int max) Adds an element representing the preferred gap between one edge of the container and the next or previousComponentwith 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(boolean useAsBaseline, GroupLayout.Group group) Adds aGroupto thisGroup.addGroup(GroupLayout.Group group) Adds aGroupto thisGroup.addPreferredGap(JComponent comp1, JComponent comp2, LayoutStyle.ComponentPlacement type) Adds an element representing the preferred gap between two components.addPreferredGap(JComponent comp1, JComponent comp2, LayoutStyle.ComponentPlacement type, int pref, int max) Adds an element representing the preferred gap between two components.Adds an element representing the preferred gap between the nearest components.addPreferredGap(LayoutStyle.ComponentPlacement type, int pref, int max) Adds an element representing the preferred gap between the nearest components.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.- Overrides:
addGroupin classGroupLayout.Group- Parameters:
group- theGroupto add- Returns:
- this
Group
-
addGroup
Adds aGroupto thisGroup.- Parameters:
useAsBaseline- whether the specifiedGroupshould be used to calculate the baseline for thisGroupgroup- theGroupto add- Returns:
- this
Group
-
addComponent
Adds aComponentto thisGroup.- Overrides:
addComponentin classGroupLayout.Group- Parameters:
component- theComponentto add- Returns:
- this
Group
-
addComponent
Adds aComponentto thisGroup.- Parameters:
useAsBaseline- whether the specifiedComponentshould be used to calculate the baseline for thisGroupcomponent- theComponentto add- Returns:
- this
Group
-
addComponent
Adds aComponentto thisGroupwith the specified size.- Overrides:
addComponentin classGroupLayout.Group- 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
-
addComponent
public GroupLayout.SequentialGroup addComponent(boolean useAsBaseline, Component component, int min, int pref, int max) Adds aComponentto thisGroupwith the specified size.- Parameters:
useAsBaseline- whether the specifiedComponentshould be used to calculate the baseline for thisGroupcomponent- 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.- Overrides:
addGapin classGroupLayout.Group- Parameters:
size- the size of the gap- Returns:
- this
Group
-
addGap
Adds a gap to thisGroupwith the specified size.- Overrides:
addGapin classGroupLayout.Group- Parameters:
min- the minimum size of the gappref- the preferred size of the gapmax- the maximum size of the gap- Returns:
- this
Group
-
addPreferredGap
public GroupLayout.SequentialGroup addPreferredGap(JComponent comp1, JComponent comp2, LayoutStyle.ComponentPlacement type) Adds an element representing the preferred gap between two components. The element created to represent the gap is not resizable.- Parameters:
comp1- the first componentcomp2- the second componenttype- the type of gap; one of the constants defined byLayoutStyle- Returns:
- this
SequentialGroup - Throws:
IllegalArgumentException- iftype,comp1orcomp2isnull- See Also:
-
addPreferredGap
public GroupLayout.SequentialGroup addPreferredGap(JComponent comp1, JComponent comp2, LayoutStyle.ComponentPlacement type, int pref, int max) Adds an element representing the preferred gap between two components.- Parameters:
comp1- the first componentcomp2- the second componenttype- the type of gappref- the preferred size of the gap; one ofDEFAULT_SIZEor a value >= 0max- the maximum size of the gap; one ofDEFAULT_SIZE,PREFERRED_SIZEor a value >= 0- Returns:
- this
SequentialGroup - Throws:
IllegalArgumentException- iftype,comp1orcomp2isnull- See Also:
-
addPreferredGap
Adds an element representing the preferred gap between the nearest components. During layout, neighboring components are found, and the size of the added gap is set based on the preferred gap between the components. If no neighboring components are found the gap has a size of0.The element created to represent the gap is not resizable.
- Parameters:
type- the type of gap; one ofLayoutStyle.ComponentPlacement.RELATEDorLayoutStyle.ComponentPlacement.UNRELATED- Returns:
- this
SequentialGroup - Throws:
IllegalArgumentException- iftypeis not one ofLayoutStyle.ComponentPlacement.RELATEDorLayoutStyle.ComponentPlacement.UNRELATED- See Also:
-
addPreferredGap
public GroupLayout.SequentialGroup addPreferredGap(LayoutStyle.ComponentPlacement type, int pref, int max) Adds an element representing the preferred gap between the nearest components. During layout, neighboring components are found, and the minimum of this gap is set based on the size of the preferred gap between the neighboring components. If no neighboring components are found the minimum size is set to 0.- Parameters:
type- the type of gap; one ofLayoutStyle.ComponentPlacement.RELATEDorLayoutStyle.ComponentPlacement.UNRELATEDpref- the preferred size of the gap; one ofDEFAULT_SIZEor a value >= 0max- the maximum size of the gap; one ofDEFAULT_SIZE,PREFERRED_SIZEor a value >= 0- Returns:
- this
SequentialGroup - Throws:
IllegalArgumentException- iftypeis not one ofLayoutStyle.ComponentPlacement.RELATEDorLayoutStyle.ComponentPlacement.UNRELATED- See Also:
-
addContainerGap
Adds an element representing the preferred gap between an edge the container and components that touch the border of the container. This has no effect if the added gap does not touch an edge of the parent container.The element created to represent the gap is not resizable.
- Returns:
- this
SequentialGroup
-
addContainerGap
Adds an element representing the preferred gap between one edge of the container and the next or previousComponentwith the specified size. This has no effect if the next or previous element is not aComponentand does not touch one edge of the parent container.- Parameters:
pref- the preferred size; one ofDEFAULT_SIZEor a value >= 0max- the maximum size; one ofDEFAULT_SIZE,PREFERRED_SIZEor a value >= 0- Returns:
- this
SequentialGroup
-