public final class Forms extends Object
| Modifier and Type | Method and Description |
|---|---|
static JComponent |
border(Border border,
JComponent component)
Creates and returns a panel where
component is surrounded
by the given border. |
static JComponent |
border(String emptyBorderSpec,
JComponent component)
Deprecated.
Use
padding(JComponent,String, Object...) instead |
static JComponent |
buttonBar(JComponent... buttons)
Creates and returns a panel where the given buttons
are laid out horizontally using a ButtonBarBuilder.
|
static JComponent |
buttonStack(JComponent... buttons)
Creates and returns a panel where the given buttons
are laid out vertically using a ButtonStackBuilder.
|
static JComponent |
centered(JComponent component)
Creates and returns a panel where
component is centered. |
static JComponent |
checkBoxBar(JCheckBox... checkBoxes)
Builds and returns a panel where the given check boxes
are laid out horizontally.
|
static JComponent |
checkBoxStack(JCheckBox... checkBoxes)
Builds and returns a panel where the given check boxes
are laid out vertically.
|
static JComponent |
horizontal(String gapColSpec,
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 JComponent |
padding(JComponent component,
EmptyBorder padding)
Creates and returns a panel where
component is surrounded
by the given empty border. |
static JComponent |
padding(JComponent component,
String paddingSpec,
Object... args)
Creates and returns a panel where
component is surrounded
by white space (an empty border) as described by paddingSpec. |
static JComponent |
radioButtonBar(JRadioButton... radioButtons)
Builds and returns a panel where the given radio buttons
are laid horizontally.
|
static JComponent |
radioButtonStack(JRadioButton... radioButtons)
Builds and returns a panel where the given radio buttons
are laid vertically.
|
static JComponent |
single(String columnSpec,
String rowSpec,
JComponent component)
Creates and returns a panel where
component is laid out
using a FormLayout with the given column and row specifications. |
static JComponent |
vertical(String gapRowSpec,
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 JComponent single(String columnSpec, String rowSpec, 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 outNullPointerException - if columnSpec, rowSpec,
or component is nullIllegalArgumentException - if columnSpec or rowSpec
is empty or whitespacepublic static JComponent centered(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 centerNullPointerException - if component is nullpublic static JComponent border(Border border, JComponent component)
component is surrounded
by the given border.
Forms.border(new LineBorder(Color.GRAY), aComponent);
border - the border used to surround the componentcomponent - the component to wrapNullPointerException - if border or component
is null@Deprecated public static JComponent border(String emptyBorderSpec, JComponent component)
padding(JComponent,String, Object...) insteadcomponent 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 wrapNullPointerException - if emptyBorderSpec
or component is nullpublic static JComponent padding(JComponent component, EmptyBorder padding)
component is surrounded
by the given empty border.
Forms.padding(aComponent, Paddings.DLU14);
component - the component to wrappadding - the empty border used to surround the componentNullPointerException - if border or component
is nullpublic static JComponent padding(JComponent component, String paddingSpec, Object... args)
component is surrounded
by white space (an empty border) as described by paddingSpec.
Forms.padding(aComponent, "4dlu, 0, 4dlu, 8dlu"); Forms.padding(aComponent, "10px 4px, 10px, %spx", left);
component - the component to wrappaddingSpec - describes the white space: top, left, bottom, rightNullPointerException - if paddingSpec
or component is nullpadding(JComponent, EmptyBorder),
Paddings.createPadding(String, Object...)public static JComponent horizontal(String gapColSpec, 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 outNullPointerException - if components is nullIllegalArgumentException - if components is emptypublic static JComponent vertical(String gapRowSpec, 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 outNullPointerException - if components is nullIllegalArgumentException - if components is emptypublic static JComponent buttonBar(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 barNullPointerException - if buttons is nullIllegalArgumentException - if buttons is emptyButtonBarBuilderpublic static JComponent buttonStack(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 stackNullPointerException - if buttons is nullIllegalArgumentException - if buttons is emptyButtonStackBuilderpublic static JComponent checkBoxBar(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 rowNullPointerException - if checkBoxes is nullIllegalArgumentException - if checkBoxes is emptypublic static JComponent checkBoxStack(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 stackNullPointerException - if checkBoxes is nullIllegalArgumentException - if checkBoxes is emptypublic static JComponent radioButtonBar(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 rowNullPointerException - if radioButtons is nullIllegalArgumentException - if radioButtons is emptypublic static JComponent radioButtonStack(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 stackNullPointerException - if radioButtons is nullIllegalArgumentException - if radioButtons is emptyCopyright © 2002-2015 JGoodies Software GmbH. All Rights Reserved.