public class ButtonFactory extends ResourceManager
Button.text = text Button.icon = icon_name Button.mnemonic = mnemonic Button.action = action_name Button.selected = true | false Button.tooltip = tool tip text where text, icon_name and action_name are strings mnemonic is a character
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ACTION_SUFFIX |
private ActionMap |
actions
The table which contains the actions
|
private static java.lang.String |
ICON_SUFFIX |
private static java.lang.String |
MNEMONIC_SUFFIX |
private static java.lang.String |
SELECTED_SUFFIX |
private static java.lang.String |
TEXT_SUFFIX |
private static java.lang.String |
TOOLTIP_SUFFIX |
bundle
Constructor and Description |
---|
ButtonFactory(java.util.ResourceBundle rb,
ActionMap am)
Creates a new button factory
|
Modifier and Type | Method and Description |
---|---|
javax.swing.JButton |
createJButton(java.lang.String name)
Creates and returns a new swing button
|
javax.swing.JCheckBox |
createJCheckBox(java.lang.String name)
Creates and returns a new swing check box
|
javax.swing.JRadioButton |
createJRadioButton(java.lang.String name)
Creates and returns a new swing radio button
|
javax.swing.JButton |
createJToolbarButton(java.lang.String name)
Creates and returns a new swing button initialised
to be used as a toolbar button
|
javax.swing.JToggleButton |
createJToolbarToggleButton(java.lang.String name)
Creates and returns a new swing button initialised
to be used as a toolbar toggle button
|
private void |
initializeButton(javax.swing.AbstractButton b,
java.lang.String name)
Initializes a button
|
getBoolean, getCharacter, getInteger, getString, getStringList, getStringList, getStringList
private static final java.lang.String ICON_SUFFIX
private static final java.lang.String TEXT_SUFFIX
private static final java.lang.String MNEMONIC_SUFFIX
private static final java.lang.String ACTION_SUFFIX
private static final java.lang.String SELECTED_SUFFIX
private static final java.lang.String TOOLTIP_SUFFIX
private ActionMap actions
public ButtonFactory(java.util.ResourceBundle rb, ActionMap am)
rb
- the resource bundle that contains the buttons
description.am
- the actions to bind to the buttonpublic javax.swing.JButton createJButton(java.lang.String name) throws java.util.MissingResourceException, ResourceFormatException, MissingListenerException
name
- the name of the button in the resource bundlejava.util.MissingResourceException
- if key is not the name of a button.
It is not thrown if the mnemonic and the action keys are missingResourceFormatException
- if the mnemonic is not a single
characterMissingListenerException
- if the button action is not found in
the action mappublic javax.swing.JButton createJToolbarButton(java.lang.String name) throws java.util.MissingResourceException, ResourceFormatException, MissingListenerException
name
- the name of the button in the resource bundlejava.util.MissingResourceException
- if key is not the name of a button.
It is not thrown if the mnemonic and the action keys are missingResourceFormatException
- if the mnemonic is not a single
characterMissingListenerException
- if the button action is not found in
the action mappublic javax.swing.JToggleButton createJToolbarToggleButton(java.lang.String name) throws java.util.MissingResourceException, ResourceFormatException, MissingListenerException
name
- the name of the button in the resource bundlejava.util.MissingResourceException
- if key is not the name of a button.
It is not thrown if the mnemonic and the action keys are missingResourceFormatException
- if the mnemonic is not a single
characterMissingListenerException
- if the button action is not found in
the action mappublic javax.swing.JRadioButton createJRadioButton(java.lang.String name) throws java.util.MissingResourceException, ResourceFormatException, MissingListenerException
name
- the name of the button in the resource bundlejava.util.MissingResourceException
- if key is not the name of a button.
It is not thrown if the mnemonic and the action keys are
missing.ResourceFormatException
- if the mnemonic is not a single
character.MissingListenerException
- if the button action is not found in
the action map.public javax.swing.JCheckBox createJCheckBox(java.lang.String name) throws java.util.MissingResourceException, ResourceFormatException, MissingListenerException
name
- the name of the button in the resource bundlejava.util.MissingResourceException
- if key is not the name of a button.
It is not thrown if the mnemonic and the action keys are missingResourceFormatException
- if the mnemonic is not a single
character.MissingListenerException
- if the button action is not found in
the action map.private void initializeButton(javax.swing.AbstractButton b, java.lang.String name) throws ResourceFormatException, MissingListenerException
b
- the button to initializename
- the button's nameResourceFormatException
- if the mnemonic is not a single
character.MissingListenerException
- if the button action is not found
in the action map.