Class NMJideButton

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, Serializable, EventListener, Accessible, SwingConstants
Direct Known Subclasses:
NMActionJideButton

@OpenApi public class NMJideButton extends com.jidesoft.swing.JideButton implements MouseListener, Serializable, KeyListener, com.nomagic.awt.HelpInformationProvider
This is simple image popup button bean. Then user moves mouse on it, button border is drawn as raised 3D rectangle; if button is pushed, it's border is drawn as hollow 3D rectangle. Button size is the same as image size. This button has three modes: pushed - is button pushed toggle - is button a toggle button. If button is not a toggle button, the user can only push it (not to release) sticky - is button is a sticky button. If button is not sticky, after mouse released it will lose it's pushed state. The button can registry ActionListeners. ActionEvent is fired when user presses and releases mouse on the button. If mouse was only pressed on the button and releases elsewhere, ActionEvent is not fired. The button also can registry HelpListeners. HelpEvent is fired when user moves mouse pointer on the button or moves it out. When mouse moves in HelpEvent is fired with parameter getTooltipText(), when mouse moves out, HelpEvent is fired with parameter null.
See Also:
  • Constructor Details

    • NMJideButton

      @OpenApi public NMJideButton()
      Constructs not pushed button with no image, empty command string and empty help string. The size of the button will be zero.
    • NMJideButton

      @OpenApi public NMJideButton(Action action)
      Creates button from given action.
      See Also:
    • NMJideButton

      @OpenApi public NMJideButton(@CheckForNull Icon icon)
      Creates button with given icon.
      Parameters:
      icon - icon for button.
      See Also:
  • Method Details

    • setIcon

      public void setIcon(@CheckForNull Icon icon)
      Overrides:
      setIcon in class com.jidesoft.swing.JideButton
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Processes the mouse release event. At first this method checks if the button has focus (mFocus is true). If this is true, ActionEvent will be thrown.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      e - the release mouse event;
    • rightClickAction

      public void rightClickAction(MouseEvent e)
      This method is called if right click is done on the button.
      Parameters:
      e - click event.
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
      See Also:
    • mousePressed

      public void mousePressed(MouseEvent e)
      Processes the mouse pressed action. After press button must be drawn as pushed.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      e - MouseEvent
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Processes the mouse enter action. This method sets focus flag, and notifies HelpListeners with parameter "help string".
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      e - MouseEvent
    • mouseExited

      public void mouseExited(MouseEvent e)
      Processes the mouse exit action. Calls notifyHelpListeners method with null as parameter.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      e - MouseEvent
      See Also:
    • addHelpListener

      public void addHelpListener(com.nomagic.awt.HelpListener l)
      Informs the component that this HelpListener is interested in the help events generated by this component.
      Specified by:
      addHelpListener in interface com.nomagic.awt.HelpInformationProvider
      Parameters:
      l - the HelpListener
      See Also:
    • removeHelpListener

      public void removeHelpListener(com.nomagic.awt.HelpListener l)
      Informs the component that this HelpListener is no longer interested in the help events generated by this component.
      Specified by:
      removeHelpListener in interface com.nomagic.awt.HelpInformationProvider
      Parameters:
      l - the HelpListener
      See Also:
    • notifyHelpListeners

      public void notifyHelpListeners(@CheckForNull String newHelp)
      Processes the mouse enter and mouse exit events. This method calls the helpChanged() methods of all the listeners who have expressed their interest by calling addHelpListener
      Parameters:
      newHelp - the new help string for HelpEvent
    • setShortcuts

      public void setShortcuts(List shortcuts)
      Sets shortcut for popup button.
    • getShortcuts

      public List getShortcuts()
      Gets list of shortcut for button activation
      Returns:
      list of shortcuts.
    • keyPressed

      public void keyPressed(KeyEvent evt)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent evt)
      Specified by:
      keyReleased in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent evt)
      Specified by:
      keyTyped in interface KeyListener
    • setToolTipText

      public void setToolTipText(String text)
      Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.

      See How to Use Tool Tips in The Java Tutorial for further documentation.

      Overrides:
      setToolTipText in class JComponent
      Parameters:
      text - the string to display; if the text is null, the tool tip is turned off for this component
      See Also:
    • createToolTip

      public JToolTip createToolTip()
      Return special implementation of tooltip component
      Overrides:
      createToolTip in class JComponent
    • addNotify

      public void addNotify()
      Overrides:
      addNotify in class JComponent
    • removeNotify

      public void removeNotify()
      Overrides:
      removeNotify in class JButton
    • setToolTipLocationProvider

      public final void setToolTipLocationProvider(@CheckForNull BiFunction<NMJideButton,MouseEvent,Point> toolTipLocationProvider)
    • getToolTipLocationProvider

      @CheckForNull public final BiFunction<NMJideButton,MouseEvent,Point> getToolTipLocationProvider()
    • getToolTipLocation

      public Point getToolTipLocation(MouseEvent event)
      Overrides:
      getToolTipLocation in class JComponent