Class NMActionJideButton

All Implemented Interfaces:
com.jidesoft.swing.Alignable, com.jidesoft.swing.AlignmentSupport, com.jidesoft.swing.ButtonStyle, com.jidesoft.swing.ComponentStateSupport, com.nomagic.awt.HelpInformationProvider, KeyListener, MouseListener, ImageObserver, ItemSelectable, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, SwingConstants

@OpenApi public class NMActionJideButton extends NMJideButton 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

    • NMActionJideButton

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

    • isShowText

      public boolean isShowText()
      Returns:
      Show action name on button even it has icon
    • setShowText

      public void setShowText(boolean showText)
      Show action name on button even it has icon
      Parameters:
      showText - show text flag
    • 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.
    • setIconProvider

      public void setIconProvider(com.nomagic.awt.ActionIconProvider iconProvider)
      Sets icon provider. By default is used default action icon provider, which takes icon from action.
      Parameters:
      iconProvider - icon provider to use.
    • 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.