Basic HTML version of Foils prepared 19 July 97

Foil 30 New AWT component: PopupMenu

From Overview of JDK Version 1.1 Extensions CPS616 -- Information Track of CPS -- Spring Semester 97. by Nancy J. McCracken


PopupMenus are defined with similar methods as regular Menus - there are methods to add menuItems.
When you add the PopupMenu itself to a component, it doesn't appear in the component window.
In the MouseListener, in the processMouseEvent() method, you can respond to the user's mouse click in the component by calling the show() method of the PopupMenu to make it appear.
The items of the PopupMenu can cause events, and you would create event listeners for those events in the usual way.
Another new AWT feature is that regular Menus can have keyboard MenuShortcuts.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998