public final class DefaultFormBuilder extends I15dPanelBuilder
FormLayout. This builder combines frequently use
panel building steps: add a new row, add a label, proceed to the nex
data column, then add a component.#append methods tha
append gap rows and component rows if necessary and then ad
the given components. They are built upon the superclass behavio
#appendRow and the set of #add methods
A set of component appenders allows to add a textual label an
associated component in a single step.
ResourceBundle in the constructor
The builder methods throw an IllegalStateException if on
of the mapping builder methods is invoked and no bundle has been set.
AbstractFormBuilderPanelBuilder can do
among other things: appending new rows and moving the cursor
Again, ask yourself if the DefaultFormBuilder is the appropriate builder
As a rule of thumb you should have more components than builder commands
There are different ways to add custom rows. Find below example cod
that presents and compares the pros and cons of three approaches.
marked texts
i.e. strings with an optional mnemonic marker
See the MnemonicUtils class comment for details.
Example:
Custom Row Example:
#appendFullSpan and #appendRemaining.
AbstractFormBuilder,
FormSpecs,
FormLayoutcurrentCellConstraints| Constructor and Description |
|---|
DefaultFormBuilder(FormLayout layout)
Constructs a
DefaultFormBuilder for the give
layout. |
DefaultFormBuilder(FormLayout layout,
JPanel container)
Constructs a
DefaultFormBuilder for the give
layout and panel. |
DefaultFormBuilder(FormLayout layout,
ResourceBundle bundle)
Constructs a
DefaultFormBuilder for the give
layout and resource bundle. |
DefaultFormBuilder(FormLayout layout,
ResourceBundle bundle,
JPanel container)
Constructs a
DefaultFormBuilder for the give
layout, resource bundle, and panel. |
DefaultFormBuilder(FormLayout layout,
com.jgoodies.common.internal.StringResourceAccessor localizer)
Constructs a
DefaultFormBuilder for the give
layout and resource bundle. |
DefaultFormBuilder(FormLayout layout,
com.jgoodies.common.internal.StringResourceAccessor localizer,
JPanel container)
Constructs a
DefaultFormBuilder for the give
layout, resource bundle, and panel. |
| Modifier and Type | Method and Description |
|---|---|
void |
append(Component component)
Adds a component to the panel using the default constraint
with a column span of 1.
|
void |
append(Component c1,
Component c2)
Adds two components to the panel; each component will span a singl
data column.
|
void |
append(Component c1,
Component c2,
Component c3)
Adds three components to the panel; each component will span a singl
data column.
|
void |
append(Component component,
int columnSpan)
Adds a component to the panel using the default constraints wit
the given columnSpan.
|
JLabel |
append(String textWithMnemonic)
Adds a text label to the panel and proceeds to the next column.
|
JLabel |
append(String textWithMnemonic,
Component component)
Adds a text label and component to the panel.
|
JLabel |
append(String textWithMnemonic,
Component c,
boolean nextLine)
Adds a text label and component to the panel; the component will spa
the specified number columns.
|
JLabel |
append(String textWithMnemonic,
Component c1,
Component c2)
Adds a text label and two components to the panel; each componen
will span a single column.
|
JLabel |
append(String textWithMnemonic,
Component c1,
Component c2,
Component c3)
Adds a text label and three components to the panel; each componen
will span a single column.
|
JLabel |
append(String textWithMnemonic,
Component c1,
Component c2,
Component c3,
Component c4)
Adds a text label and four components to the panel; each componen
will span a single column.
|
JLabel |
append(String textWithMnemonic,
Component c1,
Component c2,
int colSpan)
Adds a text label and two components to the panel; each componen
will span a single column.
|
JLabel |
append(String textWithMnemonic,
Component c,
int columnSpan)
Adds a text label and component to the panel; the component will spa
the specified number columns.
|
JLabel |
appendI15d(String resourceKey)
Adds an internationalized (i15d) text label to the panel usin
the given resource key and proceeds to the next column.
|
JLabel |
appendI15d(String resourceKey,
Component component)
Adds an internationalized (i15d) text label and componen
to the panel.
|
JLabel |
appendI15d(String resourceKey,
Component component,
boolean nextLine)
Adds an internationalized (i15d) text label and componen
to the panel.
|
JLabel |
appendI15d(String resourceKey,
Component c1,
Component c2)
Adds an internationalized (i15d) text label and two component
to the panel; each component will span a single column.
|
JLabel |
appendI15d(String resourceKey,
Component c1,
Component c2,
Component c3)
Adds an internationalized (i15d) text label and three component
to the panel; each component will span a single column.
|
JLabel |
appendI15d(String resourceKey,
Component c1,
Component c2,
Component c3,
Component c4)
Adds an internationalized (i15d) text label and four component
to the panel; each component will span a single column.
|
JLabel |
appendI15d(String resourceKey,
Component c1,
Component c2,
int colSpan)
Adds an internationalized (i15d) text label and two component
to the panel; each component will span a single column.
|
JLabel |
appendI15d(String resourceKey,
Component c,
int columnSpan)
Adds an internationalized (i15d) text label to the panel usin
the given resource key; then proceeds to the next data colum
and adds a component with the given column span.
|
JComponent |
appendI15dSeparator(String resourceKey)
Appends an internationalized titled separator fo
the given resource key that spans all columns.
|
JLabel |
appendI15dTitle(String resourceKey)
Adds an internationalized title label to the panel an
proceeds to the next column.
|
void |
appendLineGapRow()
Appends a row with this builder's line gap size.
|
JComponent |
appendSeparator()
Adds a separator without text that spans all columns.
|
JComponent |
appendSeparator(String text)
Adds a separator with the given text that spans all columns.
|
JLabel |
appendTitle(String textWithMnemonic)
Adds a title label to the panel and proceeds to the next column.
|
DefaultFormBuilder |
background(Color background)
Sets the panel's background color and the panel to be opaque.
|
DefaultFormBuilder |
border(Border border)
Sets the panel's border.
|
DefaultFormBuilder |
border(String emptyBorderSpec)
Sets the panel's border as an EmptyBorder using the given specificatio
for the top, left, bottom, right in DLU.
|
DefaultFormBuilder |
defaultRowSpec(RowSpec defaultRowSpec)
Sets the row specification that shall be used for component rows.
|
RowSpec |
getDefaultRowSpec()
Deprecated.
Obsolete; will be deleted from the next version
|
protected int |
getLeadingColumn()
Returns the leading column.
|
int |
getLeadingColumnOffset()
Deprecated.
Obsolete; will be deleted from the next version
|
RowSpec |
getLineGapSpec()
Deprecated.
Obsolete; will be deleted from the next version
|
boolean |
isRowGroupingEnabled()
Deprecated.
Obsolete; will be deleted from the next version
|
DefaultFormBuilder |
leadingColumnOffset(int columnOffset)
Sets the offset of the leading column, often 0 or 1.
|
DefaultFormBuilder |
lineGapSize(ConstantSize lineGapSize)
Sets the size of gaps between component lines using the give
constant size.
|
DefaultFormBuilder |
opaque(boolean b)
Sets the panel's opaque state.
|
DefaultFormBuilder |
paragraphGapSize(ConstantSize paragraphGapSize)
Sets the size of gaps between paragraphs using the give
constant size.
|
DefaultFormBuilder |
rowGroupingEnabled(boolean enabled)
Enables or disables the grouping of new data rows.
|
void |
setDefaultRowSpec(RowSpec defaultRowSpec)
Deprecated.
Replaced by
defaultRowSpec(RowSpec) |
void |
setLeadingColumnOffset(int columnOffset)
Deprecated.
Replaced by
leadingColumnOffset(int) |
void |
setLineGapSize(ConstantSize lineGapSize)
Deprecated.
Replaced by
lineGapSize(ConstantSize) |
void |
setParagraphGapSize(ConstantSize paragraphGapSize)
Deprecated.
Replaced by
lineGapSize(ConstantSize) |
void |
setRowGroupingEnabled(boolean enabled)
Deprecated.
Replaced by
rowGroupingEnabled(boolean) |
addI15dLabel, addI15dLabel, addI15dLabel, addI15dROLabel, addI15dROLabel, addI15dROLabel, addI15dSeparator, addI15dSeparator, addI15dTitle, addI15dTitle, debugToolTipsEnabled, focusTraversal, getResourceString, isDebugToolTipsEnabledadd, add, addLabel, addLabel, addLabel, addLabel, addROLabel, addROLabel, addROLabel, addROLabel, addSeparator, addSeparator, addSeparator, addSeparator, addTitle, addTitle, addTitle, build, getPanel, isLabelForApplicable, labelForFeatureEnabled, setBorder, setDefaultDialogBorder, setLabelFor, setOpaqueadd, add, appendColumn, appendColumn, appendGlueColumn, appendGlueRow, appendLabelComponentsGapColumn, appendParagraphGapRow, appendRelatedComponentsGapColumn, appendRelatedComponentsGapRow, appendRow, appendRow, appendUnrelatedComponentsGapColumn, appendUnrelatedComponentsGapRow, cellConstraints, createLeftAdjustedConstraints, getColumn, getColumnIncrementSign, getRow, isLeftToRight, nextColumn, nextColumn, nextLine, nextLine, nextRow, nextRow, setAlignment, setBounds, setColumn, setColumnSpan, setExtent, setHAlignment, setLeftToRight, setOrigin, setRow, setRowSpan, setVAlignmentcreateComponentFactory, getColumnCount, getComponentFactory, getContainer, getLayout, getRowCount, setComponentFactorypublic DefaultFormBuilder(FormLayout layout)
DefaultFormBuilder for the give
layout.layout - the FormLayout to be usedNullPointerException - if layout is nullpublic DefaultFormBuilder(FormLayout layout, JPanel container)
DefaultFormBuilder for the give
layout and panel.layout - the FormLayout to be usedcontainer - the layout containerNullPointerException - if layout or container is nullpublic DefaultFormBuilder(FormLayout layout, ResourceBundle bundle)
DefaultFormBuilder for the give
layout and resource bundle.layout - the FormLayout to be usedbundle - the ResourceBundle used to lookup i15
stringsNullPointerException - if layout is nullpublic DefaultFormBuilder(FormLayout layout, ResourceBundle bundle, JPanel container)
DefaultFormBuilder for the give
layout, resource bundle, and panel.layout - the FormLayout to be usedcontainer - the layout containerbundle - the ResourceBundle used to lookup i15
stringsNullPointerException - if layout or container is nullpublic DefaultFormBuilder(FormLayout layout, com.jgoodies.common.internal.StringResourceAccessor localizer)
DefaultFormBuilder for the give
layout and resource bundle.layout - the FormLayout to be usedlocalizer - used to lookup i15d stringsNullPointerException - if layout is nullpublic DefaultFormBuilder(FormLayout layout, com.jgoodies.common.internal.StringResourceAccessor localizer, JPanel container)
DefaultFormBuilder for the give
layout, resource bundle, and panel.layout - the FormLayout to be usedcontainer - the layout containerlocalizer - used to lookup i15d stringsNullPointerException - if layout or container is nullpublic DefaultFormBuilder background(Color background)
PanelBuilderbackground in class I15dPanelBuilderbackground - the color to set as new backgroundJComponent.setBackground(Color)public DefaultFormBuilder border(Border border)
PanelBuilderborder in class I15dPanelBuilderborder - the border to setJComponent.setBorder(Border)public DefaultFormBuilder border(String emptyBorderSpec)
PanelBuildersetBorder(Borders.createEmptyBorder(emptyBorderSpec)).
border in class I15dPanelBuilderemptyBorderSpec - describes the top, left, bottom, right size
of the EmptyBorder to createBorders.createEmptyBorder(String)public DefaultFormBuilder opaque(boolean b)
PanelBuilderopaque in class I15dPanelBuilderb - true for opaque, false for non-opaqueJComponent.setOpaque(boolean)public DefaultFormBuilder defaultRowSpec(RowSpec defaultRowSpec)
FormSpecs.PREF_ROWSPEC by default.defaultRowSpec - the RowSpec to be used for component rowspublic DefaultFormBuilder lineGapSize(ConstantSize lineGapSize)
Examples:
lineGapSize - the ConstantSize that describe
the size of the gaps between component linespublic DefaultFormBuilder paragraphGapSize(ConstantSize paragraphGapSize)
Examples:
paragraphGapSize - the ConstantSize that describe
the size of the gaps between paragraphspublic DefaultFormBuilder leadingColumnOffset(int columnOffset)
columnOffset - the new offset of the leading columnpublic DefaultFormBuilder rowGroupingEnabled(boolean enabled)
enabled - indicates grouping enabled, false disabled@Deprecated public RowSpec getDefaultRowSpec()
RowSpec used for component rows@Deprecated public void setDefaultRowSpec(RowSpec defaultRowSpec)
defaultRowSpec(RowSpec)FormSpecs.PREF_ROWSPEC by default.defaultRowSpec - the RowSpec to be used for component rows@Deprecated public RowSpec getLineGapSpec()
RowSpec that is used to separate component rows@Deprecated public void setLineGapSize(ConstantSize lineGapSize)
lineGapSize(ConstantSize)Examples:
lineGapSize - the ConstantSize that describe
the size of the gaps between component lines@Deprecated public void setParagraphGapSize(ConstantSize paragraphGapSize)
lineGapSize(ConstantSize)Examples:
paragraphGapSize - the ConstantSize that describe
the size of the gaps between paragraphs@Deprecated public int getLeadingColumnOffset()
@Deprecated public void setLeadingColumnOffset(int columnOffset)
leadingColumnOffset(int)columnOffset - the new offset of the leading column@Deprecated public boolean isRowGroupingEnabled()
@Deprecated public void setRowGroupingEnabled(boolean enabled)
rowGroupingEnabled(boolean)enabled - indicates grouping enabled, false disabledpublic final void appendLineGapRow()
public void append(Component component)
component - the component to addpublic void append(Component component, int columnSpan)
component - the component to appendcolumnSpan - the column span used to addpublic void append(Component c1, Component c2)
c1 - the first component to addc2 - the second component to addpublic void append(Component c1, Component c2, Component c3)
c1 - the first component to addc2 - the second component to addc3 - the third component to addpublic JLabel append(String textWithMnemonic)
textWithMnemonic - the label's text - may mark a mnemonicpublic JLabel append(String textWithMnemonic, Component component)
textWithMnemonic - the label's text - may mark a mnemoniccomponent - the component to addpublic JLabel append(String textWithMnemonic, Component c, boolean nextLine)
textWithMnemonic - the label's text - may mark a mnemonicc - the component to addnextLine - true forces a next lineJLabel.setLabelFor(java.awt.Component)public JLabel append(String textWithMnemonic, Component c, int columnSpan)
textWithMnemonic - the label's text - may mark a mnemonicc - the component to addcolumnSpan - number of columns the component shall spanJLabel.setLabelFor(java.awt.Component)public JLabel append(String textWithMnemonic, Component c1, Component c2)
textWithMnemonic - the label's text - may mark a mnemonicc1 - the first component to addc2 - the second component to addpublic JLabel append(String textWithMnemonic, Component c1, Component c2, int colSpan)
textWithMnemonic - the label's text - may mark a mnemonicc1 - the first component to addc2 - the second component to addcolSpan - the column span for the second componentpublic JLabel append(String textWithMnemonic, Component c1, Component c2, Component c3)
textWithMnemonic - the label's text - may mark a mnemonicc1 - the first component to addc2 - the second component to addc3 - the third component to addpublic JLabel append(String textWithMnemonic, Component c1, Component c2, Component c3, Component c4)
textWithMnemonic - the label's text - may mark a mnemonicc1 - the first component to addc2 - the second component to addc3 - the third component to addc4 - the fourth component to addpublic JLabel appendI15d(String resourceKey)
resourceKey - the resource key for the the label's textpublic JLabel appendI15d(String resourceKey, Component component)
resourceKey - the resource key for the text to addcomponent - the component to addpublic JLabel appendI15d(String resourceKey, Component component, boolean nextLine)
resourceKey - the resource key for the text to addcomponent - the component to addnextLine - true forces a next linepublic JLabel appendI15d(String resourceKey, Component c, int columnSpan)
resourceKey - the resource key for the text to addc - the component to addcolumnSpan - number of columns the component shall spanpublic JLabel appendI15d(String resourceKey, Component c1, Component c2)
resourceKey - the resource key for the text to addc1 - the first component to addc2 - the second component to addpublic JLabel appendI15d(String resourceKey, Component c1, Component c2, int colSpan)
resourceKey - the resource key for the text to addc1 - the first component to addc2 - the second component to addcolSpan - the column span for the second componentpublic JLabel appendI15d(String resourceKey, Component c1, Component c2, Component c3)
resourceKey - the resource key for the text to addc1 - the first component to addc2 - the second component to addc3 - the third component to addpublic JLabel appendI15d(String resourceKey, Component c1, Component c2, Component c3, Component c4)
resourceKey - the resource key for the text to addc1 - the first component to addc2 - the second component to addc3 - the third component to addc4 - the third component to addpublic JLabel appendTitle(String textWithMnemonic)
textWithMnemonic - the label's text - may mark a mnemonicpublic JLabel appendI15dTitle(String resourceKey)
resourceKey - the resource key for the title's textpublic JComponent appendSeparator()
public JComponent appendSeparator(String text)
text - the separator title textpublic JComponent appendI15dSeparator(String resourceKey)
resourceKey - the resource key for the separator title's textprotected int getLeadingColumn()
getLeadingColumn in class AbstractFormBuilderCopyright © 2002-2014 JGoodies Software GmbH. All Rights Reserved.