Class MetalMenuUI.MouseInputHandler

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener
    Enclosing class:
    MetalMenuUI

    protected class MetalMenuUI.MouseInputHandler
    extends java.lang.Object
    implements javax.swing.event.MouseInputListener
    Instantiated and used by a menu item to handle the current menu selection from mouse events. A MouseInputHandler processes and forwards all mouse events to a shared instance of the MenuSelectionManager.

    This class is protected so that it can be subclassed by other look and feels to implement their own mouse handling behavior. All overridden methods should call the parent methods so that the menu selection is correct.

    Since:
    1.4
    See Also:
    MenuSelectionManager
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MouseInputHandler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.awt.Container getFirstParentMenuElement​(java.awt.Component comp)  
      void mouseClicked​(java.awt.event.MouseEvent e)  
      void mouseDragged​(java.awt.event.MouseEvent e)
      Invoked when a mouse button is pressed on the menu and then dragged.
      void mouseEntered​(java.awt.event.MouseEvent e)
      Invoked when the cursor enters the menu.
      void mouseExited​(java.awt.event.MouseEvent e)  
      void mouseMoved​(java.awt.event.MouseEvent e)  
      void mousePressed​(java.awt.event.MouseEvent e)  
      void mouseReleased​(java.awt.event.MouseEvent e)
      Invoked when the mouse has been released on the menu.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MouseInputHandler

        protected MouseInputHandler()
    • Method Detail

      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • getFirstParentMenuElement

        protected java.awt.Container getFirstParentMenuElement​(java.awt.Component comp)
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Invoked when the mouse has been released on the menu. Delegates the mouse event to the MenuSelectionManager.
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        e - the mouse event
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Invoked when the cursor enters the menu. This method sets the selected path for the MenuSelectionManager and handles the case in which a menu item is used to pop up an additional menu, as in a hierarchical menu system.
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        e - the mouse event; not used
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent e)
        Invoked when a mouse button is pressed on the menu and then dragged. Delegates the mouse event to the MenuSelectionManager.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        e - the mouse event
        See Also:
        MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent e)
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener