| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
GroupLayout layout = …;
GroupLayout.ParallelGroup vGroup = layout.createParallelGroup();
Based on 115 examples
public class GroupLayout.ParallelGroup extends GroupLayout.Group
A {@code Group} that aligns and sizes it's children. {@code ParallelGroup} aligns it's children in four possible ways: along the baseline, centered, anchored to the leading edge, or anchored to the trailing edge.
The baseline anchor may be explicitly specified by the {@code createBaselineGroup} method, or determined based on the elements. If not explicitly specified, the baseline will be anchored to the bottom if all the elements with a baseline, and that are aligned to the baseline, have a baseline resize behavior of {@code CONSTANT_DESCENT}; otherwise the baseline is anchored to the top of the group.
Elements aligned to the baseline are resizable if they have have a baseline resize behavior of {@code CONSTANT_ASCENT} or {@code CONSTANT_DESCENT}. Elements with a baseline resize behavior of {@code OTHER} or {@code CENTER_OFFSET} are not resizable.
The baseline is calculated based on the preferred height of each of the elements that have a baseline. The baseline is calculated using the following algorithm: {@code max(maxNonBaselineHeight, maxAscent + maxDescent)}, where the {@code maxNonBaselineHeight} is the maximum height of all elements that do not have a baseline, or are not aligned along the baseline. {@code maxAscent} is the maximum ascent (baseline) of all elements that have a baseline and are aligned along the baseline. {@code maxDescent} is the maximum descent (preferred height - baseline) of all elements that have a baseline and are aligned along the baseline.
A {@code ParallelGroup} that aligns it's elements along the baseline is only useful along the vertical axis. If you create a baseline group and use it along the horizontal axis an {@code IllegalStateException} is thrown when you ask {@code GroupLayout} for the minimum, preferred or maximum size or attempt to layout the components.
Elements that are not aligned to the baseline and smaller than the size of the {@code ParallelGroup} are positioned in one of three ways: centered, anchored to the leading edge, or anchored to the trailing edge.
The leading edge is based on the axis and {@code ComponentOrientation}. For the vertical axis the top edge is always the leading edge, and the bottom edge is always the trailing edge. When the {@code ComponentOrientation} is {@code LEFT_TO_RIGHT}, the leading edge is the left edge and the trailing edge the right edge. A {@code ComponentOrientation} of {@code RIGHT_TO_LEFT} flips the left and right edges. Child elements are aligned based on the specified alignment the element was added with. If you do not specify an alignment, the alignment specified for the {@code ParallelGroup} is used.
To align elements along the baseline you {@code createBaselineGroup}, or {@code createParallelGroup} with an alignment of {@code BASELINE}. If the group was not created with a baseline alignment, and you attempt to add an element specifying a baseline alignment, an {@code IllegalArgumentException} is thrown.
Method Summary | |
---|---|
GroupLayout.ParallelGroup |
addComponent(Component component) Adds a to this . |
GroupLayout.ParallelGroup |
addComponent(Component component, GroupLayout.Alignment alignment) Adds a to this with the specified alignment. |
GroupLayout.ParallelGroup |
addComponent(Component component, GroupLayout.Alignment alignment, int min, int pref, int max) Adds a to this with the specified alignment and size. |
GroupLayout.ParallelGroup |
addComponent(Component component, int min, int pref, int max) Adds a to this . |
GroupLayout.ParallelGroup |
addGap(int pref) Adds a rigid gap to this . |
GroupLayout.ParallelGroup |
addGap(int min, int pref, int max) Adds a rigid gap to this . |
GroupLayout.ParallelGroup |
addGroup(GroupLayout.Alignment alignment, GroupLayout.Group group) Adds a to this with the specified alignment. |
GroupLayout.ParallelGroup |
addGroup(GroupLayout.Group group) Adds a to this . |
Methods inherited from class javax.swing.GroupLayout.Group |
---|
addComponent, addComponent, addGap, addGap, addGroup |
Method Detail |
---|
public GroupLayout.ParallelGroup addComponent(Component component)
addComponent
in class GroupLayout.Group
component
public GroupLayout.ParallelGroup addComponent(Component component, GroupLayout.Alignment alignment)
component
- the {@code Component} to addalignment
- the alignmentpublic GroupLayout.ParallelGroup addComponent(Component component, GroupLayout.Alignment alignment, int min, int pref, int max)
component
- the {@code Component} to addalignment
- the alignmentmin
- the minimum sizepref
- the preferred sizemax
- the maximum sizepublic GroupLayout.ParallelGroup addComponent(Component component, int min, int pref, int max)
addComponent
in class GroupLayout.Group
component
min
pref
max
public GroupLayout.ParallelGroup addGap(int pref)
addGap
in class GroupLayout.Group
pref
public GroupLayout.ParallelGroup addGap(int min, int pref, int max)
addGap
in class GroupLayout.Group
min
pref
max
public GroupLayout.ParallelGroup addGroup(GroupLayout.Alignment alignment, GroupLayout.Group group)
alignment
- the alignmentgroup
- the {@code Group} to addpublic GroupLayout.ParallelGroup addGroup(GroupLayout.Group group)
addGroup
in class GroupLayout.Group
group
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |