Extension SDK 10.1.2

oracle.javatools.controls
Class TextMenuPopupHandler

java.lang.Object
  extended byjava.awt.event.MouseAdapter
      extended byoracle.javatools.controls.TextMenuPopupHandler
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.awt.event.MouseListener

public class TextMenuPopupHandler
extends java.awt.event.MouseAdapter
implements java.awt.event.ActionListener

TextMenuPopupHandler creates popup (context) menus for text components. Each popup menu contains CUT, COPY, PASTE, and SELECT ALL commands. Selecting the command from the menu invokes the given command on the JTextComponent being managed by the TextPopupHandler instance.


Constructor Summary
TextMenuPopupHandler(javax.swing.text.JTextComponent comp)
          Constructs a new TextPopupHandler instance.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Perform the action selected by the user.
protected  void maybeShowPopup(java.awt.event.MouseEvent e)
          Checks to see if the user requested the popup menu, and displays it if so.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
 
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
 

Constructor Detail

TextMenuPopupHandler

public TextMenuPopupHandler(javax.swing.text.JTextComponent comp)
Constructs a new TextPopupHandler instance.

Parameters:
comp - The JTextComponent for whom this TextPopupHandler should create a context menu.
Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

maybeShowPopup

protected void maybeShowPopup(java.awt.event.MouseEvent e)
Checks to see if the user requested the popup menu, and displays it if so. Each TextPopupHandler contains a single instance of a JPopupMenu, which is created on demand.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Perform the action selected by the user.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.