|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.forms.builder.AbstractFormBuilder
com.jgoodies.forms.builder.PanelBuilder
com.jgoodies.forms.builder.ButtonStackBuilder
public final class ButtonStackBuilder
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(); }
ButtonBarBuilder2
,
ButtonBarFactory
,
LayoutStyle
Constructor Summary | |
---|---|
ButtonStackBuilder()
Constructs a ButtonStackBuilder on a default JPanel using a preconfigured FormLayout as layout manager. |
|
ButtonStackBuilder(FormLayout layout,
javax.swing.JPanel panel)
Constructs a ButtonStackBuilder on the given panel and layout. |
|
ButtonStackBuilder(javax.swing.JPanel panel)
Constructs a ButtonStackBuilder on the given panel using a preconfigured FormLayout as layout manager. |
Method Summary | |
---|---|
void |
addButton(javax.swing.Action action)
Creates a JButton for the given Action and adds
the button to this builder. |
void |
addButton(javax.swing.Action[] actions)
Constructs an array of JButtons from the given Action array, and adds them as a sequence of related buttons separated by a default gap. |
void |
addButton(javax.swing.Action action1,
javax.swing.Action action2)
Creates JButton s for the given Actions and adds
the buttons to this builder. |
void |
addButton(javax.swing.Action action1,
javax.swing.Action action2,
javax.swing.Action action3)
Creates JButton s for the given Actions and adds
the buttons to this builder. |
void |
addButton(javax.swing.Action action1,
javax.swing.Action action2,
javax.swing.Action action3,
javax.swing.Action action4)
Creates JButton s for the given Actions and adds
the buttons to this builder. |
void |
addButton(javax.swing.JButton button)
Adds the given button. |
void |
addButton(javax.swing.JButton[] buttons)
Adds a sequence of related buttons separated by a default gap. |
void |
addButton(javax.swing.JButton button1,
javax.swing.JButton button2)
Adds the given buttons as a sequence of related buttons. |
void |
addButton(javax.swing.JButton button1,
javax.swing.JButton button2,
javax.swing.JButton button3)
Adds the given buttons as a sequence of related buttons. |
void |
addButton(javax.swing.JButton button1,
javax.swing.JButton button2,
javax.swing.JButton button3,
javax.swing.JButton button4)
Adds the given buttons as a sequence of related buttons. |
void |
addButtons(javax.swing.JButton[] buttons)
Adds a sequence of related buttons separated by a default gap. |
void |
addFixed(javax.swing.JComponent component)
Adds a fixed size component. |
void |
addGlue()
Adds a glue that will be given the extra space, if this box is larger than its preferred size. |
void |
addGridded(javax.swing.JComponent component)
Adds a gridded component. |
void |
addRelatedGap()
Adds the standard gap for related components. |
void |
addStrut(ConstantSize size)
Adds a strut of a specified size. |
void |
addUnrelatedGap()
Adds the standard gap for unrelated components. |
Methods inherited from class com.jgoodies.forms.builder.PanelBuilder |
---|
add, add, addLabel, addLabel, addLabel, addLabel, addROLabel, addROLabel, addROLabel, addROLabel, addSeparator, addSeparator, addSeparator, addSeparator, addTitle, addTitle, addTitle, getComponentFactory, getLabelForFeatureEnabledDefault, getPanel, isLabelForApplicable, isLabelForFeatureEnabled, setBackground, setBorder, setComponentFactory, setDefaultDialogBorder, setLabelFor, setLabelForFeatureEnabled, setLabelForFeatureEnabledDefault, setOpaque |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ButtonStackBuilder()
public ButtonStackBuilder(javax.swing.JPanel panel)
panel
- the layout containerpublic ButtonStackBuilder(FormLayout layout, javax.swing.JPanel panel)
layout
- the FormLayout used to layoutpanel
- the layout containerMethod Detail |
---|
public void addButtons(javax.swing.JButton[] buttons)
buttons
- an array of buttons to addpublic void addFixed(javax.swing.JComponent component)
component
- the component to addpublic void addGridded(javax.swing.JComponent component)
component
- the component to addpublic void addGlue()
public void addRelatedGap()
public void addUnrelatedGap()
public void addStrut(ConstantSize size)
size
- a constant that describes the gappublic void addButton(javax.swing.JButton button)
addButton(new JButton[]{button});
button
- the button to addpublic void addButton(javax.swing.JButton button1, javax.swing.JButton button2)
addButton(new JButton[]{button1, button2});
button1
- the first button to addbutton2
- the second button to addpublic void addButton(javax.swing.JButton button1, javax.swing.JButton button2, javax.swing.JButton button3)
addButton(new JButton[]{button1, button2, button3});
button1
- the first button to addbutton2
- the second button to addbutton3
- the third button to addpublic void addButton(javax.swing.JButton button1, javax.swing.JButton button2, javax.swing.JButton button3, javax.swing.JButton button4)
addButton(new JButton[]{button1, button2, button3, button4});
button1
- the first button to addbutton2
- the second button to addbutton3
- the third button to addbutton4
- the fourth button to addpublic void addButton(javax.swing.JButton[] buttons)
buttons
- the array of buttons to addpublic void addButton(javax.swing.Action action)
JButton
for the given Action and adds
the button to this builder.
Equivalent to:
addButton(new Action[]{action});
action
- the Action used to create the button to addpublic void addButton(javax.swing.Action action1, javax.swing.Action action2)
JButton
s for the given Actions and adds
the buttons to this builder.
Equivalent to:
addButton(new Action[]{action1, action2});
action1
- the Action used to create the first button to addaction2
- the Action used to create the second button to addpublic void addButton(javax.swing.Action action1, javax.swing.Action action2, javax.swing.Action action3)
JButton
s for the given Actions and adds
the buttons to this builder.
Equivalent to:
addButton(new Action[]{action1, action2, action3});
action1
- the Action used to create the first button to addaction2
- the Action used to create the second button to addaction3
- the Action used to create the third button to addpublic void addButton(javax.swing.Action action1, javax.swing.Action action2, javax.swing.Action action3, javax.swing.Action action4)
JButton
s for the given Actions and adds
the buttons to this builder.
Equivalent to:
addButton(new Action[]{action1, action2, action3, action4});
action1
- the Action used to create the first button to addaction2
- the Action used to create the second button to addaction3
- the Action used to create the third button to addaction4
- the Action used to create the fourth button to addpublic void addButton(javax.swing.Action[] actions)
actions
- an array of buttons to add
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |