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. |