public final class Forms
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
Forms() |
| Modifier and Type | Method and Description |
|---|---|
static javax.swing.JComponent |
border(javax.swing.border.Border border,
javax.swing.JComponent component)
Creates and returns a panel where
component is surrounded
by the given border. |
static javax.swing.JComponent |
border(java.lang.String emptyBorderSpec,
javax.swing.JComponent component)
Creates and returns a panel where
component is surrounded
by an empty border as described by emptyBorderSpec. |
private static javax.swing.JComponent |
buildGroupedButtonBar(javax.swing.AbstractButton... buttons)
Builds and returns a button bar that consists of the given buttons.
|
private static javax.swing.JComponent |
buildGroupedButtonStack(javax.swing.AbstractButton... buttons)
Builds and returns a button bar that consists of the given buttons.
|
static javax.swing.JComponent |
buttonBar(javax.swing.JComponent... buttons)
Creates and returns a panel where the given buttons
are laid out horizontally using a ButtonBarBuilder.
|
static javax.swing.JComponent |
buttonStack(javax.swing.JComponent... buttons)
Creates and returns a panel where the given buttons
are laid out vertically using a ButtonStackBuilder.
|
static javax.swing.JComponent |
centered(javax.swing.JComponent component)
Creates and returns a panel where
component is centered. |
static javax.swing.JComponent |
checkBoxBar(javax.swing.JCheckBox... checkBoxes)
Builds and returns a panel where the given check boxes
are laid out horizontally.
|
static javax.swing.JComponent |
checkBoxStack(javax.swing.JCheckBox... checkBoxes)
Builds and returns a panel where the given check boxes
are laid out vertically.
|
static javax.swing.JComponent |
horizontal(java.lang.String gapColSpec,
javax.swing.JComponent... components)
Builds and returns a panel where the given components are laid out
horizontally separated by gaps as described by the given
FormLayout gap (column) specification.
|
static javax.swing.JComponent |
radioButtonBar(javax.swing.JRadioButton... radioButtons)
Builds and returns a panel where the given radio buttons
are laid horizontally.
|
static javax.swing.JComponent |
radioButtonStack(javax.swing.JRadioButton... radioButtons)
Builds and returns a panel where the given radio buttons
are laid vertically.
|
static javax.swing.JComponent |
single(java.lang.String columnSpec,
java.lang.String rowSpec,
javax.swing.JComponent component)
Creates and returns a panel where
component is laid out
using a FormLayout with the given column and row specifications. |
static javax.swing.JComponent |
vertical(java.lang.String gapRowSpec,
javax.swing.JComponent... components)
Builds and returns a panel where the given components are laid out
vertically separated by gaps as described by the given
FormLayout gap (row) specification.
|
public static javax.swing.JComponent single(java.lang.String columnSpec,
java.lang.String rowSpec,
javax.swing.JComponent component)
component is laid out
using a FormLayout with the given column and row specifications.
Forms.single( "left:150dlu", "c:p", component);
Forms.single( "fill:150dlu:grow", "f:20dlu", component);
Forms.single("center:150dlu", "b:p:g", component);
columnSpec - a FormLayout column specification for a single columnrowSpec - a FormLayout row specification for a single rowcomponent - the component to lay outjava.lang.NullPointerException - if columnSpec, rowSpec,
or component is nulljava.lang.IllegalArgumentException - if columnSpec or rowSpec
is empty or whitespacepublic static javax.swing.JComponent centered(javax.swing.JComponent component)
component is centered.
The panel grows both horizontally and vertically as its container grows.
Forms.centered(anImageLabel); Forms.centered(anAnimatedPanel);
component - the component to centerjava.lang.NullPointerException - if component is nullpublic static javax.swing.JComponent border(javax.swing.border.Border border,
javax.swing.JComponent component)
component is surrounded
by the given border.
Forms.border(Borders.DLU14, aComponent); Forms.border(new LineBorder(Color.GRAY), aComponent);
border - the border used to surround the componentcomponent - the component to wrapjava.lang.NullPointerException - if border or component
is nullpublic static javax.swing.JComponent border(java.lang.String emptyBorderSpec,
javax.swing.JComponent component)
component is surrounded
by an empty border as described by emptyBorderSpec.
Forms.border("4dlu, 0, 4dlu, 8dlu", aComponent);
Forms.border("10px 4px, 10px, 4px", aComponent);
component - the component to wrapjava.lang.NullPointerException - if emptyBorderSpec
or component is nullpublic static javax.swing.JComponent horizontal(java.lang.String gapColSpec,
javax.swing.JComponent... components)
Forms.horizontal("4dlu", component1, component2);
Forms.horizontal("$rgap", component1, component2, component3);
Forms.horizontal("0", component1, component2, component3);
gapColSpec - describes the horizontal gap between the componentscomponents - the components to be laid outjava.lang.NullPointerException - if components is nulljava.lang.IllegalArgumentException - if components is emptypublic static javax.swing.JComponent vertical(java.lang.String gapRowSpec,
javax.swing.JComponent... components)
Forms.vertical("4dlu", component1, component2);
Forms.vertical("$rgap", component1, component2, component3);
Forms.vertical("0", component1, component2, component3);
gapRowSpec - describes the vertical gap between the componentscomponents - the components to be laid outjava.lang.NullPointerException - if components is nulljava.lang.IllegalArgumentException - if components is emptypublic static javax.swing.JComponent buttonBar(javax.swing.JComponent... buttons)
ButtonBarBuilder.create().addButton(buttons).build();
If class com.jgoodies.jsdl.common.focus.FocusTraversalUtils
from the JSDL Common library is in the class path,
it is used to build a focus group for the buttons. Focus is transferred
between the buttons with cursor-left/-right.
buttons - the buttons to add to the button barjava.lang.NullPointerException - if buttons is nulljava.lang.IllegalArgumentException - if buttons is emptyButtonBarBuilderpublic static javax.swing.JComponent buttonStack(javax.swing.JComponent... buttons)
ButtonStackBuilder.create().addButton(buttons).build();
If class com.jgoodies.jsdl.common.focus.FocusTraversalUtils
from the JSDL Common library is in the class path,
it is used to build a focus group for the buttons. Focus is transferred
between the buttons with cursor-left/-right.
buttons - the buttons to add to the button stackjava.lang.NullPointerException - if buttons is nulljava.lang.IllegalArgumentException - if buttons is emptyButtonStackBuilderpublic static javax.swing.JComponent checkBoxBar(javax.swing.JCheckBox... checkBoxes)
If class com.jgoodies.jsdl.common.focus.FocusTraversalUtils
from the JSDL Common library is in the class path,
it is used to group the radio buttons. Focus is transferred to/from
the selected button in a group; and cursor-left/-right change
the selection in the group.
checkBoxes - the check boxes to lay out in a rowjava.lang.NullPointerException - if checkBoxes is nulljava.lang.IllegalArgumentException - if checkBoxes is emptypublic static javax.swing.JComponent checkBoxStack(javax.swing.JCheckBox... checkBoxes)
If class com.jgoodies.jsdl.common.focus.FocusTraversalUtils
from the JSDL Common library is in the class path,
it is used to group the radio buttons. Focus is transferred to/from
the selected button in a group; and cursor-left/-right change
the selection in the group.
checkBoxes - the check boxes to lay out in a stackjava.lang.NullPointerException - if checkBoxes is nulljava.lang.IllegalArgumentException - if checkBoxes is emptypublic static javax.swing.JComponent radioButtonBar(javax.swing.JRadioButton... radioButtons)
If class com.jgoodies.jsdl.common.focus.FocusTraversalUtils
from the JSDL Common library is in the class path,
it is used to group the radio buttons. Focus is transferred to/from
the selected button in a group; and cursor-left/-right change
the selection in the group.
radioButtons - the radio buttons to lay out in a rowjava.lang.NullPointerException - if radioButtons is nulljava.lang.IllegalArgumentException - if radioButtons is emptypublic static javax.swing.JComponent radioButtonStack(javax.swing.JRadioButton... radioButtons)
If class com.jgoodies.jsdl.common.focus.FocusTraversalUtils
from the JSDL Common library is in the class path,
it is used to group the radio buttons. Focus is transferred to/from
the selected button in a group; and cursor-left/-right change
the selection in the group.
radioButtons - the radio buttons to lay out in a stackjava.lang.NullPointerException - if radioButtons is nulljava.lang.IllegalArgumentException - if radioButtons is emptyprivate static javax.swing.JComponent buildGroupedButtonBar(javax.swing.AbstractButton... buttons)
FocusTraversalUtils,
if in the class path.private static javax.swing.JComponent buildGroupedButtonStack(javax.swing.AbstractButton... buttons)
FocusTraversalUtils,
if in the class path.