This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class GroupLayout.ParallelGroup

javax.swing.GroupLayout.Group extended by javax.swing.GroupLayout.ParallelGroup
Enclosing class:
GroupLayout

Most common way to construct:

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.

Baseline

A {@code ParallelGroup} that aligns it's children along the baseline must first decide where the baseline is anchored. The baseline can either be anchored to the top, or anchored to the bottom of the group. That is, the distance between the baseline and the beginning of the group can be a constant distance, or the distance between the end of the group and the baseline can be a constant distance. The possible choices correspond to the {@code BaselineResizeBehavior} constants {@link java.awt.Component.BaselineResizeBehavior#CONSTANT_ASCENT CONSTANT_ASCENT} and {@link java.awt.Component.BaselineResizeBehavior#CONSTANT_DESCENT CONSTANT_DESCENT}.

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.

Non-baseline {@code ParallelGroup}

{@code ParallelGroup}s created with an alignment other than {@code BASELINE} align elements that are smaller than the size of the group 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

          Adds a to this .
 GroupLayout.ParallelGroup

          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

          Adds a to this with the specified alignment.
 GroupLayout.ParallelGroup

          Adds a to this .
 
Methods inherited from class javax.swing.GroupLayout.Group
addComponent, addComponent, addGap, addGap, addGroup
 

Method Detail

addComponent

public GroupLayout.ParallelGroup addComponent(Component component)
{@inheritDoc}

Overrides:
addComponent in class GroupLayout.Group
Parameters:
component

addComponent

public GroupLayout.ParallelGroup addComponent(Component component,
                                              GroupLayout.Alignment alignment)
Adds a {@code Component} to this {@code ParallelGroup} with the specified alignment.

Parameters:
component - the {@code Component} to add
alignment - the alignment
Returns:
this {@code Group}

addComponent

public GroupLayout.ParallelGroup addComponent(Component component,
                                              GroupLayout.Alignment alignment,
                                              int min,
                                              int pref,
                                              int max)
Adds a {@code Component} to this {@code ParallelGroup} with the specified alignment and size.

Parameters:
component - the {@code Component} to add
alignment - the alignment
min - the minimum size
pref - the preferred size
max - the maximum size
Returns:
this {@code Group}

addComponent

public GroupLayout.ParallelGroup addComponent(Component component,
                                              int min,
                                              int pref,
                                              int max)
{@inheritDoc}

Overrides:
addComponent in class GroupLayout.Group
Parameters:
component
min
pref
max

addGap

public GroupLayout.ParallelGroup addGap(int pref)
{@inheritDoc}

Overrides:
addGap in class GroupLayout.Group
Parameters:
pref

addGap

public GroupLayout.ParallelGroup addGap(int min,
                                        int pref,
                                        int max)
{@inheritDoc}

Overrides:
addGap in class GroupLayout.Group
Parameters:
min
pref
max

addGroup

public GroupLayout.ParallelGroup addGroup(GroupLayout.Alignment alignment,
                                          GroupLayout.Group group)
Adds a {@code Group} to this {@code ParallelGroup} with the specified alignment. If the child is smaller than the {@code Group} it is aligned based on the specified alignment.

Parameters:
alignment - the alignment
group - the {@code Group} to add
Returns:
this {@code ParallelGroup}

addGroup

public GroupLayout.ParallelGroup addGroup(GroupLayout.Group group)
{@inheritDoc}

Overrides:
addGroup in class GroupLayout.Group
Parameters:
group


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.