Class GMouseListenerAdapter

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

    public class GMouseListenerAdapter
    extends java.awt.event.MouseAdapter
    A mouse listener implementation designed to provide consistent handling of triggers for popups and double-clicking.

    Notes:

    • Popup triggers always supersedes double-click actions.
    • The stage an action triggers (pressed/released/clicked) is platform dependent.
    • Each of the methods mentioned below will be called as appropriate.
    • You can override any of these methods to be called for each trigger.
    • Normally popups are handled by the framework via custom actions. But, for custom widgets it is sometimes simpler to handle your own popups. This class makes that easier
    See Also:
    popupTriggered(MouseEvent), doubleClickTriggered(MouseEvent), shouldConsume(MouseEvent)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doubleClickTriggered​(java.awt.event.MouseEvent e)
      Called when a double-click event is discovered.
      void mouseClicked​(java.awt.event.MouseEvent e)  
      void mousePressed​(java.awt.event.MouseEvent e)  
      void mouseReleased​(java.awt.event.MouseEvent e)  
      void popupTriggered​(java.awt.event.MouseEvent e)
      Called when a popup event is discovered.
      boolean shouldConsume​(java.awt.event.MouseEvent e)
      This method is called to ask the client if they wish to consume the given event.
      • Methods inherited from class java.awt.event.MouseAdapter

        mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
      • Methods inherited from class java.lang.Object

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

      • GMouseListenerAdapter

        public GMouseListenerAdapter()
    • Method Detail

      • shouldConsume

        public boolean shouldConsume​(java.awt.event.MouseEvent e)
        This method is called to ask the client if they wish to consume the given event. This allows clients to keep events from propagating to other listeners.
        Parameters:
        e - the event to potentially consume
        Returns:
        true if the event should be consumed
      • doubleClickTriggered

        public void doubleClickTriggered​(java.awt.event.MouseEvent e)
        Called when a double-click event is discovered.
        Parameters:
        e - the event that triggered the double-click
      • popupTriggered

        public void popupTriggered​(java.awt.event.MouseEvent e)
        Called when a popup event is discovered.
        Parameters:
        e - the event that triggered the popup
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class java.awt.event.MouseAdapter
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Overrides:
        mouseReleased in class java.awt.event.MouseAdapter
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Overrides:
        mouseClicked in class java.awt.event.MouseAdapter