| java.lang.Object com.jgoodies.forms.builder.AbstractFormBuilder com.jgoodies.forms.builder.PanelBuilder com.jgoodies.forms.builder.ButtonStackBuilder
ButtonStackBuilder | final public class ButtonStackBuilder extends PanelBuilder (Code) | | A non-visual builder that assists you in building consistent button stacks
using the
FormLayout .
This builder sets a hint for narrow margin for the gridded buttons.
This can reduce the button stack's width if some buttons have long texts.
For example, a stack with 'OK', 'Cancel', 'Configure...' will likely
exceed the minimum button width. The narrow margins help getting narrow
stacks.
Note that some look&feels do not support the narrow margin feature,
and conversely, others have only narrow margins. The JGoodies look&feels
honor the setting, the Mac Aqua l&f uses narrow margins all the time.
Example:
The following example builds a button stack with Close, Up and
Down, where Up and Down are related, and Close is not related
to the other buttons, which makes a wide gap for the unrelated and
a smaller gap for the related buttons.
private JPanel createCloseUpDownButtonStack(
JButton close, JButton up, JButton down) {
ButtonStackBuilder builder = new ButtonStackBuilder();
builder.addGridded(close);
builder.addUnrelatedGap();
builder.addGridded(up);
builder.addRelatedGap();
builder.addGridded(down);
return builder.getPanel();
}
author: Karsten Lentzsch version: $Revision: 1.2 $ See Also: ButtonBarBuilder See Also: com.jgoodies.forms.factories.ButtonBarFactory See Also: com.jgoodies.forms.util.LayoutStyle |
Constructor Summary | |
public | ButtonStackBuilder() Constructs an instance of ButtonStackBuilder on a default
JPanel using a preconfigured FormLayout as layout manager. | public | ButtonStackBuilder(JPanel panel) Constructs an instance of ButtonStackBuilder on the given
panel using a preconfigured FormLayout as layout manager. |
Method Summary | |
public void | addButtons(JButton[] buttons) Adds a sequence of related buttons separated by a default gap. | public void | addFixed(JComponent component) Adds a fixed size component. | public void | addGlue() Adds a glue that will be given the extra space,
if this box is larger than its preferred size. | public void | addGridded(JComponent component) Adds a gridded component. | public void | addRelatedGap() Adds the standard gap for related components. | public void | addStrut(ConstantSize size) Adds a strut of a specified size. | public void | addUnrelatedGap() Adds the standard gap for unrelated components. |
ButtonStackBuilder | public ButtonStackBuilder()(Code) | | Constructs an instance of ButtonStackBuilder on a default
JPanel using a preconfigured FormLayout as layout manager.
|
ButtonStackBuilder | public ButtonStackBuilder(JPanel panel)(Code) | | Constructs an instance of ButtonStackBuilder on the given
panel using a preconfigured FormLayout as layout manager.
Parameters: panel - the layout container |
addButtons | public void addButtons(JButton[] buttons)(Code) | | Adds a sequence of related buttons separated by a default gap.
Parameters: buttons - an array of buttons to add |
addFixed | public void addFixed(JComponent component)(Code) | | Adds a fixed size component.
Parameters: component - the component to add |
addGlue | public void addGlue()(Code) | | Adds a glue that will be given the extra space,
if this box is larger than its preferred size.
|
addGridded | public void addGridded(JComponent component)(Code) | | Adds a gridded component.
Parameters: component - the component to add |
addRelatedGap | public void addRelatedGap()(Code) | | Adds the standard gap for related components.
|
addStrut | public void addStrut(ConstantSize size)(Code) | | Adds a strut of a specified size.
Parameters: size - a constant that describes the gap |
addUnrelatedGap | public void addUnrelatedGap()(Code) | | Adds the standard gap for unrelated components.
|
Methods inherited from com.jgoodies.forms.builder.PanelBuilder | final public JLabel add(JLabel label, CellConstraints labelConstraints, Component component, CellConstraints componentConstraints)(Code)(Java Doc) final public JLabel addLabel(String textWithMnemonic)(Code)(Java Doc) final public JLabel addLabel(String textWithMnemonic, CellConstraints constraints)(Code)(Java Doc) final public JLabel addLabel(String textWithMnemonic, String encodedConstraints)(Code)(Java Doc) final public JLabel addLabel(String textWithMnemonic, CellConstraints labelConstraints, Component component, CellConstraints componentConstraints)(Code)(Java Doc) final public JComponent addSeparator(String textWithMnemonic)(Code)(Java Doc) final public JComponent addSeparator(String textWithMnemonic, CellConstraints constraints)(Code)(Java Doc) final public JComponent addSeparator(String textWithMnemonic, String encodedConstraints)(Code)(Java Doc) final public JComponent addSeparator(String textWithMnemonic, int columnSpan)(Code)(Java Doc) final public JLabel addTitle(String textWithMnemonic)(Code)(Java Doc) final public JLabel addTitle(String textWithMnemonic, CellConstraints constraints)(Code)(Java Doc) final public JLabel addTitle(String textWithMnemonic, String encodedConstraints)(Code)(Java Doc) final public ComponentFactory getComponentFactory()(Code)(Java Doc) final public JPanel getPanel()(Code)(Java Doc) final public void setBackground(Color background)(Code)(Java Doc) final public void setBorder(Border border)(Code)(Java Doc) final public void setComponentFactory(ComponentFactory newFactory)(Code)(Java Doc) final public void setDefaultDialogBorder()(Code)(Java Doc) final public void setOpaque(boolean b)(Code)(Java Doc)
|
|
|