B
- the type of the builder, e.g. ButtonBarBuilderpublic abstract class AbstractBuilder<B extends AbstractBuilder<B>> extends Object
FormLayout
.Builders hide details of the FormLayout and provide convenience behavior that assists you in constructing a form, bar, stack. This class provides a cell cursor that helps you traverse a form while you add components. Also, it offers several methods to append custom and logical columns and rows.
Modifier and Type | Field and Description |
---|---|
protected CellConstraints |
currentCellConstraints
Holds an instance of
CellConstraints that will be used to
specify the location, extent and alignments of the component to be
added next. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractBuilder(FormLayout layout,
JPanel panel)
Constructs an AbstractBuilder for the given layout and panel.
|
Modifier and Type | Method and Description |
---|---|
B |
background(Color background)
Sets the panel's background color and makes the panel opaque.
|
B |
border(Border border)
Sets the panel's border.
|
B |
border(String paddingSpec)
Deprecated.
Replaced by
padding(String, Object...) |
abstract JPanel |
build() |
protected ComponentFactory |
createComponentFactory()
Invoked when the per-instance component factory is lazily initialized.
|
int |
getColumnCount()
Returns the number of columns in the form.
|
ComponentFactory |
getComponentFactory()
Returns this builder's component factory.
|
Container |
getContainer()
Deprecated.
Replaced by
getPanel() |
FormLayout |
getLayout()
Returns the FormLayout instance used to build this form.
|
JPanel |
getPanel()
Returns the panel used to build the form.
|
int |
getRowCount()
Returns the number of rows in the form.
|
B |
opaque(boolean b)
Sets the panel's opaque state.
|
B |
padding(EmptyBorder padding)
Sets a padding around this builder's panel.
|
B |
padding(String paddingSpec,
Object... args)
Sets the panel's padding as an EmptyBorder using the given specification
for the top, left, bottom, right margins in DLU.
|
void |
setComponentFactory(ComponentFactory newFactory)
Sets a new component factory for this builder,
overriding the default as provided by
FormsSetup.getComponentFactoryDefault() . |
protected final CellConstraints currentCellConstraints
CellConstraints
that will be used to
specify the location, extent and alignments of the component to be
added next.protected AbstractBuilder(FormLayout layout, JPanel panel)
layout
- the FormLayout to usepanel
- the layout containerNullPointerException
- if layout
or panel
is null
public final JPanel getPanel()
build()
.public abstract JPanel build()
@Deprecated public final Container getContainer()
getPanel()
public final FormLayout getLayout()
public final int getColumnCount()
public final int getRowCount()
public B background(Color background)
background
- the color to set as new backgroundJComponent.setBackground(Color)
public B border(Border border)
border
- the border to setJComponent.setBorder(Border)
@Deprecated public B border(String paddingSpec)
padding(String, Object...)
Equivalent to padding(Paddings.createPadding(paddingSpec))
.
paddingSpec
- describes the top, left, bottom, right sizes
of the EmptyBorder to createPaddings.createPadding(String, Object...)
public B padding(EmptyBorder padding)
padding
- the empty border to setJComponent.setBorder(Border)
public B padding(String paddingSpec, Object... args)
Equivalent to setPadding(Paddings.createPadding(paddingSpec))
.
paddingSpec
- describes the top, left, bottom, right margins
of the padding (an EmptyBorder) to useargs
- optional format arguments,
used if paddingSpec
is a format stringpadding(EmptyBorder)
,
Paddings.createPadding(String, Object...)
public B opaque(boolean b)
b
- true for opaque, false for non-opaqueJComponent.setOpaque(boolean)
public final ComponentFactory getComponentFactory()
FormsSetup.getComponentFactoryDefault()
.setComponentFactory(ComponentFactory)
public final void setComponentFactory(ComponentFactory newFactory)
FormsSetup.getComponentFactoryDefault()
.newFactory
- the component factory to be used for this buildergetComponentFactory()
protected ComponentFactory createComponentFactory()
Subclasses may override to use a factory other than the global default.
However, in most cases it is sufficient to just set a new global default
using FormsSetup.setComponentFactoryDefault(ComponentFactory)
.
Copyright © 2002-2015 JGoodies Software GmbH. All Rights Reserved.