org.openide.awt 6.7.22

org.openide.awt
Class MouseUtils.PopupMouseAdapter

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by org.openide.awt.MouseUtils.PopupMouseAdapter
All Implemented Interfaces:
MouseListener, EventListener
Enclosing class:
MouseUtils

public abstract static class MouseUtils.PopupMouseAdapter
extends MouseAdapter

The PopupMouseAdapter provides safe way to implement popup menu invocation mechanism. It should be used instead of invoking the popup in mouseClicked because the mouseClicked does not work as "often" as it should (i.e. sometimes it is not called). PopupMouseAdapter delegates to isPopupTrigger to get correct popup menu invocation gesture. Clients are supposed to extend this class and implement showPopup method by adding code that shows popup menu properly.
Please note that older implementation which used treshold is now deprecated, please use default constructor.


Field Summary
static int DEFAULT_THRESHOLD
          Deprecated. Obsoleted as of 3.4, PopupMouseAdapter now uses isPopupTrigger properly. Threshold does nothing, please use default constructor without treshold.
 
Constructor Summary
MouseUtils.PopupMouseAdapter()
          Constructs PopupMouseAdapter.
MouseUtils.PopupMouseAdapter(int threshold)
          Deprecated. Obsoleted as of 3.4, by class rewrite to use isPopupTrigger. This constructor now just delegates to super constructor, please use default constructor instead.
 
Method Summary
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
protected abstract  void showPopup(MouseEvent evt)
          Called when the sequnce of mouse events should lead to actual showing of the popup menu.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseExited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_THRESHOLD

public static final int DEFAULT_THRESHOLD
Deprecated. Obsoleted as of 3.4, PopupMouseAdapter now uses isPopupTrigger properly. Threshold does nothing, please use default constructor without treshold.
See Also:
Constant Field Values
Constructor Detail

MouseUtils.PopupMouseAdapter

public MouseUtils.PopupMouseAdapter(int threshold)
Deprecated. Obsoleted as of 3.4, by class rewrite to use isPopupTrigger. This constructor now just delegates to super constructor, please use default constructor instead.

Creates a new PopupMouseAdapter with specified threshold

Parameters:
threshold - The threshold to be used

MouseUtils.PopupMouseAdapter

public MouseUtils.PopupMouseAdapter()
Constructs PopupMouseAdapter. Just delegates to super constructor

Method Detail

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

showPopup

protected abstract void showPopup(MouseEvent evt)
Called when the sequnce of mouse events should lead to actual showing of the popup menu. Should be redefined to show the menu. param evt The mouse release event - should be used to obtain the position of the popup menu


org.openide.awt 6.7.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.