Class GMouseListenerAdapter

java.lang.Object
java.awt.event.MouseAdapter
docking.event.mouse.GMouseListenerAdapter
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class GMouseListenerAdapter extends 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:
  • Constructor Details

    • GMouseListenerAdapter

      public GMouseListenerAdapter()
  • Method Details

    • shouldConsume

      public boolean shouldConsume(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(MouseEvent e)
      Called when a double-click event is discovered.
      Parameters:
      e - the event that triggered the double-click
    • popupTriggered

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

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class MouseAdapter
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class MouseAdapter
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
      Overrides:
      mouseClicked in class MouseAdapter