com.jgoodies.forms.factories
Interface ComponentFactory
- DefaultComponentFactory
public interface ComponentFactory
An interface that defines the factory methods as used by the
PanelBuilder and its subclasses.
The texts used in methods
#createLabel(String) and
#createTitle(String) can contain an optional mnemonic marker.
The mnemonic and mnemonic index are indicated by a single ampersand
(
&). For example
"&Save",
or
"Save &as". To use the ampersand itself
duplicate it, for example
"Look&&Feel".
JLabel | createLabel(String textWithMnemonic)- Creates and returns a label with an optional mnemonic.
|
JComponent | createSeparator(String text, int alignment)- Creates and returns a labeled separator.
|
JLabel | createTitle(String textWithMnemonic)- Creates and returns a label that uses the foreground color
and font of a
TitledBorder.
|
createLabel
public JLabel createLabel(String textWithMnemonic)
Creates and returns a label with an optional mnemonic.
createLabel("Name"); // No mnemonic
createLabel("N&ame"); // Mnemonic is 'a'
createLabel("Save &as"); // Mnemonic is the second 'a'
createLabel("Look&&Feel"); // No mnemonic, text is Look&Feel
textWithMnemonic - the label's text - may contain a mnemonic
- an label with optional mnemonic
createSeparator
public JComponent createSeparator(String text,
int alignment) Creates and returns a labeled separator. Useful to separate paragraphs
in a panel, which is often a better choice than a
TitledBorder.
text - the title's textalignment - text alignment: left, center, right
- a title label with separator on the side
createTitle
public JLabel createTitle(String textWithMnemonic)
Creates and returns a label that uses the foreground color
and font of a
TitledBorder.
createTitle("Name"); // No mnemonic
createTitle("N&ame"); // Mnemonic is 'a'
createTitle("Save &as"); // Mnemonic is the second 'a'
createTitle("Look&&Feel"); // No mnemonic, text is Look&Feel
textWithMnemonic - the title's text - may contain a mnemonic
- an emphasized title label
Copyright © 2002-2004 JGoodies Karsten Lentzsch. All Rights Reserved.