Class NMActionButton

All Implemented Interfaces:
com.nomagic.awt.HelpInformationProvider, KeyListener, MouseListener, ImageObserver, ItemSelectable, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, SwingConstants

@OpenApi public class NMActionButton extends NMPopupButton implements PropertyChangeListener
Button created from action. All properties for button(text, icon, tool tip...) are taken from action. Also action is added as button ActionListener. Button listens for changes in action and updates it state according the action state.
See Also:
  • Constructor Details

    • NMActionButton

      @OpenApi public NMActionButton(NMAction action)
      Constructs new button with given action.
      Parameters:
      action - action for the button.
  • Method Details

    • getToolTipText

      @OpenApi public static String getToolTipText(NMAction action)
      Creates tooltip text for button from given action. Tooltip will have action description or name and representation of first shortcut.
      Parameters:
      action - the given action.
    • getToolTipText

      @OpenApi public String getToolTipText()
      Creates tool tip text from button action. Tool tip will have action description or name and representation of first shortcut.
      Overrides:
      getToolTipText in class JComponent
    • getAction

      @OpenApi public Action getAction()
      Returns action of this button.
      Overrides:
      getAction in class AbstractButton
      Returns:
      action of this button.
    • updateShortcuts

      protected void updateShortcuts()
      Updates shortcuts for button. New shortcuts are taken from action.
    • updateIcon

      protected void updateIcon()
      Updates icon for button. New icon is taken from action.getLargeIcon().
    • propertyChange

      public void propertyChange(PropertyChangeEvent event)
      Listens to changes in action and updates properties of button.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      event - the property change event.