Class Forms
- Since:
- 1.6
- Version:
- $Revision: 1.1 $
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JComponent
border
(String emptyBorderSpec, JComponent component) Deprecated.static JComponent
border
(Border border, JComponent component) Creates and returns a panel wherecomponent
is surrounded by the given border.private static JComponent
buildGroupedButtonBar
(AbstractButton... buttons) Builds and returns a button bar that consists of the given buttons.private static JComponent
buildGroupedButtonStack
(AbstractButton... buttons) Builds and returns a button bar that consists of the given buttons.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 wherecomponent
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, String paddingSpec, Object... args) Creates and returns a panel wherecomponent
is surrounded by white space (an empty border) as described bypaddingSpec
.static JComponent
padding
(JComponent component, EmptyBorder padding) Creates and returns a panel wherecomponent
is surrounded by the given empty border.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 wherecomponent
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.
-
Constructor Details
-
Forms
private Forms()
-
-
Method Details
-
single
Creates and returns a panel wherecomponent
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);
- Parameters:
columnSpec
- a FormLayout column specification for a single columnrowSpec
- a FormLayout row specification for a single rowcomponent
- the component to lay out- Returns:
- the built panel
- Throws:
NullPointerException
- ifcolumnSpec
,rowSpec
, orcomponent
isnull
IllegalArgumentException
- ifcolumnSpec
orrowSpec
is empty or whitespace
-
centered
Creates and returns a panel wherecomponent
is centered. The panel grows both horizontally and vertically as its container grows.Forms.centered(anImageLabel); Forms.centered(anAnimatedPanel);
- Parameters:
component
- the component to center- Returns:
- the built panel
- Throws:
NullPointerException
- ifcomponent
isnull
-
border
Creates and returns a panel wherecomponent
is surrounded by the given border.Forms.border(new LineBorder(Color.GRAY), aComponent);
- Parameters:
border
- the border used to surround the componentcomponent
- the component to wrap- Returns:
- the built panel
- Throws:
NullPointerException
- ifborder
orcomponent
isnull
-
border
Deprecated.Usepadding(JComponent,String, Object...)
insteadCreates and returns a panel wherecomponent
is surrounded by an empty border as described byemptyBorderSpec
.Forms.border("4dlu, 0, 4dlu, 8dlu", aComponent); Forms.border("10px 4px, 10px, 4px", aComponent);
- Parameters:
component
- the component to wrap- Returns:
- the built panel
- Throws:
NullPointerException
- ifemptyBorderSpec
orcomponent
isnull
-
padding
Creates and returns a panel wherecomponent
is surrounded by the given empty border.Forms.padding(aComponent, Paddings.DLU14);
- Parameters:
component
- the component to wrappadding
- the empty border used to surround the component- Returns:
- the built panel
- Throws:
NullPointerException
- ifborder
orcomponent
isnull
-
padding
Creates and returns a panel wherecomponent
is surrounded by white space (an empty border) as described bypaddingSpec
.Forms.padding(aComponent, "4dlu, 0, 4dlu, 8dlu"); Forms.padding(aComponent, "10px 4px, 10px, %spx", left);
- Parameters:
component
- the component to wrappaddingSpec
- describes the white space: top, left, bottom, right- Returns:
- the built panel
- Throws:
NullPointerException
- ifpaddingSpec
orcomponent
isnull
- See Also:
-
horizontal
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.Forms.horizontal("4dlu", component1, component2); Forms.horizontal("$rgap", component1, component2, component3); Forms.horizontal("0", component1, component2, component3);
- Parameters:
gapColSpec
- describes the horizontal gap between the componentscomponents
- the components to be laid out- Returns:
- the built panel
- Throws:
NullPointerException
- ifcomponents
isnull
IllegalArgumentException
- ifcomponents
is empty
-
vertical
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.Forms.vertical("4dlu", component1, component2); Forms.vertical("$rgap", component1, component2, component3); Forms.vertical("0", component1, component2, component3);
- Parameters:
gapRowSpec
- describes the vertical gap between the componentscomponents
- the components to be laid out- Returns:
- the built panel
- Throws:
NullPointerException
- ifcomponents
isnull
IllegalArgumentException
- ifcomponents
is empty
-
buttonBar
Creates and returns a panel where the given buttons are laid out horizontally using a ButtonBarBuilder. Equivalent to: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.- Parameters:
buttons
- the buttons to add to the button bar- Returns:
- the built button bar
- Throws:
NullPointerException
- ifbuttons
isnull
IllegalArgumentException
- ifbuttons
is empty- See Also:
-
buttonStack
Creates and returns a panel where the given buttons are laid out vertically using a ButtonStackBuilder. Equivalent to: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.- Parameters:
buttons
- the buttons to add to the button stack- Returns:
- the built button stack
- Throws:
NullPointerException
- ifbuttons
isnull
IllegalArgumentException
- ifbuttons
is empty- Since:
- 1.8
- See Also:
-
checkBoxBar
Builds and returns a panel where the given check boxes are laid out horizontally.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.- Parameters:
checkBoxes
- the check boxes to lay out in a row- Returns:
- the built panel
- Throws:
NullPointerException
- ifcheckBoxes
isnull
IllegalArgumentException
- ifcheckBoxes
is empty
-
checkBoxStack
Builds and returns a panel where the given check boxes are laid out vertically.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.- Parameters:
checkBoxes
- the check boxes to lay out in a stack- Returns:
- the built panel
- Throws:
NullPointerException
- ifcheckBoxes
isnull
IllegalArgumentException
- ifcheckBoxes
is empty- Since:
- 1.8
-
radioButtonBar
Builds and returns a panel where the given radio buttons are laid horizontally.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.- Parameters:
radioButtons
- the radio buttons to lay out in a row- Returns:
- the built panel
- Throws:
NullPointerException
- ifradioButtons
isnull
IllegalArgumentException
- ifradioButtons
is empty
-
radioButtonStack
Builds and returns a panel where the given radio buttons are laid vertically.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.- Parameters:
radioButtons
- the radio buttons to lay out in a stack- Returns:
- the built panel
- Throws:
NullPointerException
- ifradioButtons
isnull
IllegalArgumentException
- ifradioButtons
is empty- Since:
- 1.8
-
buildGroupedButtonBar
Builds and returns a button bar that consists of the given buttons. Aims to build a focus group via theFocusTraversalUtils
, if in the class path.- Returns:
- the built panel
-
buildGroupedButtonStack
Builds and returns a button bar that consists of the given buttons. Aims to build a focus group via theFocusTraversalUtils
, if in the class path.- Returns:
- the built panel
-
padding(JComponent,String, Object...)
instead