站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

MouseUtils.PopupMouseAdapter (NetBeans APIs) - NetBeans API Javadoc 4.1.0


org.openide.awt
Class MouseUtils.PopupMouseAdapter

java.lang.Object
  extended byjava.awt.event.MouseAdapter
      extended byorg.openide.awt.MouseUtils.PopupMouseAdapter
All Implemented Interfaces:
EventListener, MouseListener
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)

mouseReleased

public void mouseReleased(MouseEvent e)

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



Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.