ti.chimera
Class PopupTrigger
java.lang.Object
java.awt.event.MouseAdapter
ti.chimera.PopupTrigger
- All Implemented Interfaces:
- java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
- public class PopupTrigger
- extends java.awt.event.MouseAdapter
- implements java.awt.event.MouseMotionListener
A utility MouseListener
which can be used to trigger something,
such as displaying a pop-up menu, in response to a particular mouse event,
in particular clicking mouse button 2 or 3, or clicking and holding any
button for a length of time. Any place that may display a popup menu should
use this to preserve a consistant look and feel, and also to properly
support single button mice.
Perhaps this should implement KeyListener or something like that... that
way a certain key sequence could trigger a popup??
NOTE: netbeans has an interesting idea, using the mousePressed and
mouseReleased events to determine when to display the pop-up; they
claim it is more reliable that using mouseClicked. If there are
problems with this, have a look at how they do it in the utility
class org.openide.awt.MouseUtils.PopupMouseAdapter.
- Version:
- 0.0
- Author:
- Rob Clark
Nested Class Summary |
static interface |
PopupTrigger.PopupListener
This interface should be implemented by the user of this utility mouse
listener. |
Methods inherited from class java.awt.event.MouseAdapter |
mouseEntered, mouseExited |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PopupTrigger
public PopupTrigger(PopupTrigger.PopupListener l)
- Class Constructor.
- Parameters:
l
- the listener to call when popup trigger has occured
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent evt)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent evt)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent evt)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent evt)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent evt)
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener