Home » openjdk-7 » javax » swing » [javadoc | source]
javax.swing
public class: GroupLayout.ParallelGroup [javadoc | source]
java.lang.Object
   javax.swing.GroupLayout.Spring
      javax.swing.GroupLayout.Group
         javax.swing.GroupLayout$ParallelGroup

Direct Known Subclasses:
    BaselineGroup

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 CONSTANT_ASCENT and 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.

Fields inherited from javax.swing.GroupLayout$Group:
springs
Constructor:
 ParallelGroup(Alignment childAlignment,
    boolean resizable) 
Method from javax.swing.GroupLayout$ParallelGroup Summary:
addComponent,   addComponent,   addComponent,   addComponent,   addGap,   addGap,   addGroup,   addGroup,   calculateMaximumSize,   calculateMinimumSize,   insertAutopadding,   isResizable,   operator,   setChildSize,   setValidSize
Methods from javax.swing.GroupLayout$Group:
addComponent,   addComponent,   addGap,   addGap,   addGroup,   addSpring,   calculateAutopadding,   calculateMaximumSize,   calculateMinimumSize,   calculatePreferredSize,   calculateSize,   getSpring,   getSpringSize,   indexOf,   insertAutopadding,   operator,   removeAutopadding,   setSize,   setValidSize,   unsetAutopadding,   willHaveZeroSize
Methods from javax.swing.GroupLayout$Spring:
calculateMaximumSize,   calculateMinimumSize,   calculatePreferredSize,   constrain,   getAlignment,   getBaseline,   getBaselineResizeBehavior,   getMaximumSize,   getMinimumSize,   getParent,   getPreferredSize,   getSize,   isResizable,   setAlignment,   setParent,   setSize,   unset,   willHaveZeroSize
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.GroupLayout$ParallelGroup Detail:
 public ParallelGroup addComponent(Component component) 
    {@inheritDoc}
 public ParallelGroup addComponent(Component component,
    Alignment alignment) 
    Adds a {@code Component} to this {@code ParallelGroup} with the specified alignment.
 public ParallelGroup addComponent(Component component,
    int min,
    int pref,
    int max) 
    {@inheritDoc}
 public ParallelGroup addComponent(Component component,
    Alignment alignment,
    int min,
    int pref,
    int max) 
    Adds a {@code Component} to this {@code ParallelGroup} with the specified alignment and size.
 public ParallelGroup addGap(int pref) 
    {@inheritDoc}
 public ParallelGroup addGap(int min,
    int pref,
    int max) 
    {@inheritDoc}
 public ParallelGroup addGroup(Group group) 
    {@inheritDoc}
 public ParallelGroup addGroup(Alignment alignment,
    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.
 int calculateMaximumSize(int axis) 
 int calculateMinimumSize(int axis) 
  void insertAutopadding(int axis,
    List<AutoPreferredGapSpring> leadingPadding,
    List<AutoPreferredGapSpring> trailingPadding,
    List<ComponentSpring> leading,
    List<ComponentSpring> trailing,
    boolean insert) 
 boolean isResizable() 
 int operator(int a,
    int b) 
  void setChildSize(Spring spring,
    int axis,
    int origin,
    int size) 
  void setValidSize(int axis,
    int origin,
    int size)