Class ButtonFactory
java.lang.Object
org.apache.batik.util.resources.ResourceManager
org.apache.batik.util.gui.resource.ButtonFactory
This class represents a button factory which builds
buttons from the content of a resource bundle.
The resource entries format is (for a button named 'Button'):
The resource entries format is (for a button named 'Button'):
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
- Version:
- $Id: ButtonFactory.java 1733416 2016-03-03 07:07:13Z gadams $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private ActionMap
The table which contains the actionsprivate static final String
private static final String
private static final String
private static final String
private static final String
Fields inherited from class org.apache.batik.util.resources.ResourceManager
bundle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateJButton
(String name) Creates and returns a new swing buttoncreateJCheckBox
(String name) Creates and returns a new swing check boxcreateJRadioButton
(String name) Creates and returns a new swing radio buttoncreateJToolbarButton
(String name) Creates and returns a new swing button initialised to be used as a toolbar buttonCreates and returns a new swing button initialised to be used as a toolbar toggle buttonprivate void
initializeButton
(AbstractButton b, String name) Initializes a buttonMethods inherited from class org.apache.batik.util.resources.ResourceManager
getBoolean, getCharacter, getInteger, getString, getStringList, getStringList, getStringList
-
Field Details
-
ICON_SUFFIX
- See Also:
-
TEXT_SUFFIX
- See Also:
-
MNEMONIC_SUFFIX
- See Also:
-
ACTION_SUFFIX
- See Also:
-
SELECTED_SUFFIX
- See Also:
-
TOOLTIP_SUFFIX
- See Also:
-
actions
The table which contains the actions
-
-
Constructor Details
-
ButtonFactory
Creates a new button factory- Parameters:
rb
- the resource bundle that contains the buttons description.am
- the actions to bind to the button
-
-
Method Details
-
createJButton
public JButton createJButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException Creates and returns a new swing button- Parameters:
name
- the name of the button in the resource bundle- Throws:
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 map
-
createJToolbarButton
public JButton createJToolbarButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException Creates and returns a new swing button initialised to be used as a toolbar button- Parameters:
name
- the name of the button in the resource bundle- Throws:
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 map
-
createJToolbarToggleButton
public JToggleButton createJToolbarToggleButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException Creates and returns a new swing button initialised to be used as a toolbar toggle button- Parameters:
name
- the name of the button in the resource bundle- Throws:
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 map
-
createJRadioButton
public JRadioButton createJRadioButton(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException Creates and returns a new swing radio button- Parameters:
name
- the name of the button in the resource bundle- Throws:
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.
-
createJCheckBox
public JCheckBox createJCheckBox(String name) throws MissingResourceException, ResourceFormatException, MissingListenerException Creates and returns a new swing check box- Parameters:
name
- the name of the button in the resource bundle- Throws:
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.
-
initializeButton
private void initializeButton(AbstractButton b, String name) throws ResourceFormatException, MissingListenerException Initializes a button- Parameters:
b
- the button to initializename
- the button's name- Throws:
ResourceFormatException
- if the mnemonic is not a single character.MissingListenerException
- if the button action is not found in the action map.
-