com.jgoodies.forms.extras
Class PanelBuilder2

java.lang.Object
  extended by com.jgoodies.forms.builder.AbstractFormBuilder
      extended by com.jgoodies.forms.builder.PanelBuilder
          extended by com.jgoodies.forms.extras.PanelBuilder2

public class PanelBuilder2
extends PanelBuilder

Adds a feature to its superclass PanelBuilder that labels with a mnemonic are associated with the next added focusable component. This feature shall be moved to the PanelBuilder.

Version:
$Revision: 1.1 $
Author:
Karsten Lentzsch

Constructor Summary
PanelBuilder2(FormLayout layout)
          Constructs a PanelBuilder2 for the given layout.
PanelBuilder2(FormLayout layout, javax.swing.JPanel panel)
          Constructs a PanelBuilder2 for the given FormLayout and layout container.
 
Method Summary
 java.awt.Component add(java.awt.Component component, CellConstraints cellConstraints)
          Adds a component to the panel using the given cell constraints.
protected  boolean isLabelForApplicable(java.awt.Component component)
          Checks and answers whether the given component shall be set as component for a previously added label with mnemonic using JLabel.setLabelFor(Component).
protected  boolean isLabelForFeatureActive()
          Checks and answers whether the labelFor feature is active for this builder.
 
Methods inherited from class com.jgoodies.forms.builder.PanelBuilder
add, addLabel, addLabel, addLabel, addLabel, addSeparator, addSeparator, addSeparator, addSeparator, addTitle, addTitle, addTitle, getComponentFactory, getPanel, setBackground, setBorder, setComponentFactory, setDefaultDialogBorder, setOpaque
 
Methods inherited from class com.jgoodies.forms.builder.AbstractFormBuilder
add, add, appendColumn, appendColumn, appendGlueColumn, appendGlueRow, appendLabelComponentsGapColumn, appendParagraphGapRow, appendRelatedComponentsGapColumn, appendRelatedComponentsGapRow, appendRow, appendRow, appendUnrelatedComponentsGapColumn, appendUnrelatedComponentsGapRow, cellConstraints, createLeftAdjustedConstraints, getColumn, getColumnCount, getColumnIncrementSign, getContainer, getLayout, getLeadingColumn, getRow, getRowCount, isLeftToRight, nextColumn, nextColumn, nextLine, nextLine, nextRow, nextRow, setAlignment, setBounds, setColumn, setColumnSpan, setExtent, setHAlignment, setLeftToRight, setOrigin, setRow, setRowSpan, setVAlignment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PanelBuilder2

public PanelBuilder2(FormLayout layout)
Constructs a PanelBuilder2 for the given layout. Uses an instance of JPanel as layout container with the given layout as layout manager.

Parameters:
layout - the FormLayout to use

PanelBuilder2

public PanelBuilder2(FormLayout layout,
                     javax.swing.JPanel panel)
Constructs a PanelBuilder2 for the given FormLayout and layout container.

Parameters:
layout - the FormLayout to use
panel - the layout container to build on
Method Detail

add

public java.awt.Component add(java.awt.Component component,
                              CellConstraints cellConstraints)
Adds a component to the panel using the given cell constraints. In addition to the superclass behavior, this implementation tracks the most recently label that has mnemonic, and associates it with the next added focusable component.

Overrides:
add in class AbstractFormBuilder
Parameters:
component - the component to add
cellConstraints - the component's cell constraints
Returns:
the added component
See Also:
isLabelForFeatureActive(), isLabelForApplicable(Component)

isLabelForFeatureActive

protected boolean isLabelForFeatureActive()
Checks and answers whether the labelFor feature is active for this builder.

Returns:
true for active, false for inactive

isLabelForApplicable

protected boolean isLabelForApplicable(java.awt.Component component)
Checks and answers whether the given component shall be set as component for a previously added label with mnemonic using JLabel.setLabelFor(Component). The current implementation just checks whether the component is focusable.

Parameters:
component - the component to be checked
Returns:
true if focusable, false otherwise


Copyright © 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.