Class ToolBarAction

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public abstract class ToolBarAction extends EnhancedAction
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 Details

    • actionPanel

      protected final ActionPanel actionPanel
    • groupName

      protected final String groupName
  • Constructor Details

    • ToolBarAction

      public ToolBarAction(ActionPanel actionPanel, String groupName, String tooltip, ImageIcon icon)
      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

      public String 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.