public class DefaultComponentFactory extends Object implements ComponentFactory
ComponentFactory interfac
that creates UI components as required by th
PanelBuilder.#createLabel(String) an
#createTitle(String) can contain an optional mnemonic marker
The mnemonic and mnemonic index are indicated by a single ampersan
(&). For example "&Save"
or "Save &as". To use the ampersand itsel
duplicate it, for example "Look&&Feel".
| Constructor and Description |
|---|
DefaultComponentFactory() |
| Modifier and Type | Method and Description |
|---|---|
JButton |
createButton(Action action)
Creates and returns a button that is bound to the given Action.
|
JLabel |
createHeaderLabel(String markedText)
Creates and returns a label intended for pane headers that use
a larger font than the control font and a special foreground color.
|
JLabel |
createLabel(String textWithMnemonic)
Creates and returns a label with an optional mnemonic.
|
JLabel |
createReadOnlyLabel(String textWithMnemonic)
Creates and returns a label with an optional mnemoni
that is intended to label a read-only component.
|
JComponent |
createSeparator(JLabel label)
Creates and returns a labeled separator.
|
JComponent |
createSeparator(String textWithMnemonic)
Creates and returns a labeled separator with the label in the left-han
side.
|
JComponent |
createSeparator(String textWithMnemonic,
int alignment)
Creates and returns a labeled separator.
|
JLabel |
createTitle(String textWithMnemonic)
Creates and returns a title label that uses the foreground colo
and font of a
TitledBorder. |
static DefaultComponentFactory |
getInstance()
Returns the sole instance of this factory class.
|
public static DefaultComponentFactory getInstance()
public JLabel createLabel(String textWithMnemonic)
createLabel in interface ComponentFactorytextWithMnemonic - the label's text
may contain an ampersand (&) to mark a mnemonicpublic JLabel createReadOnlyLabel(String textWithMnemonic)
createReadOnlyLabel in interface ComponentFactorytextWithMnemonic - the label's text
may contain an ampersand (&) to mark a mnemonicpublic JButton createButton(Action action)
JGButton is bound to some custom Action properties.JButton.
createButton in interface ComponentFactoryaction - provides [bound] visual properties for the buttonpublic JLabel createTitle(String textWithMnemonic)
TitledBorder.createTitle in interface ComponentFactorytextWithMnemonic - the label's text
may contain an ampersand (&) to mark a mnemonicpublic JLabel createHeaderLabel(String markedText)
ComponentFactorymarkedText is "&Charge Codes", the tex will be set to "Charge Codes", the mnemonic is 'C', and th mnemonic index is 0.
ComponentFactory.createTitle(String).
createHeaderLabel in interface ComponentFactorymarkedText - the label text with optional mnemonic markerpublic JComponent createSeparator(String textWithMnemonic)
TitledBorder.textWithMnemonic - the label's text
may contain an ampersand (&) to mark a mnemonicpublic JComponent createSeparator(String textWithMnemonic, int alignment)
TitledBorder.createSeparator in interface ComponentFactorytextWithMnemonic - the label's text
may contain an ampersand (&) to mark a mnemonicalignment - text alignment, one of SwingConstants.LEFT
SwingConstants.CENTER, SwingConstants.RIGHTpublic JComponent createSeparator(JLabel label)
TitledBorder.SwingConstants.LEFT
SwingConstants.CENTER
SwingConstants.RIGHT.
label - the title label componentNullPointerException - if the label is nullIllegalArgumentException - if the label's horizontal alignmen
is not one of: SwingConstants.LEFT
SwingConstants.CENTER
SwingConstants.RIGHT.Copyright © 2002-2014 JGoodies Software GmbH. All Rights Reserved.