Package ca.corbett.extras.actionpanel
Class ToolBarAction
java.lang.Object
javax.swing.AbstractAction
ca.corbett.extras.EnhancedAction
ca.corbett.extras.actionpanel.ToolBarAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action
An abstract base class for actions that are intended to be added to a ToolBar.
The principal difference between this class and the parent EnhancedAction class
is that we insist on an icon, and we ignore the action name.
Tooltips are recommended but not required. Instances of this class are also
linked to an ActionPanel, and more specifically to a named ActionGroup within
that panel. This provides context for the implementing classes so that they
can act on the correct ActionGroup when triggered.
- Since:
- swing-extras 2.8
- Author:
- scorbo2
- See Also:
-
Field Summary
FieldsFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsConstructorDescriptionToolBarAction(ActionPanel actionPanel, String groupName, String tooltip, ImageIcon icon) Unlike a regular EnhancedAction, we don't care about action name here. -
Method Summary
Modifier and TypeMethodDescriptionGets the name of the ActionGroup that this action will act upon.Methods inherited from class ca.corbett.extras.EnhancedAction
getAcceleratorKey, getDescription, getIcon, getName, getTooltip, setAcceleratorKey, setDescription, setIcon, setName, setTooltipMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.awt.event.ActionListener
actionPerformed
-
Field Details
-
actionPanel
-
groupName
-
-
Constructor Details
-
ToolBarAction
Unlike a regular EnhancedAction, we don't care about action name here. You must instead supply the name of the ActionGroup (case-insensitive) that this action will act upon. You should also specify a non-null tooltip for the button, though this can be null or empty for no tooltip.Note that icons are required! Our buttons are icon-only and do not show text. You can use any of the built-in icons in SwingFormsResources if you don't have one handy.
- Parameters:
actionPanel- The containing ActionPanel.groupName- The name of the ActionGroup that this action will act upon. This is case-insensitive.tooltip- The tooltip to show on the button for this action. Can be null or empty for no tooltip.icon- The icon for this action. Can't be null (our buttons are icon-only).
-
-
Method Details
-
getGroupName
Gets the name of the ActionGroup that this action will act upon. This is case-insensitive.- Returns:
- The name of the ActionGroup that this action will act upon. This is case-insensitive.
-