Creating a popup menu
To add a popup menu to a form:
- Click on the popup menu icon under the Swing or AWT tab in the Component Palette.
- Click anywhere on the form to add it.
The new menu will appear under the
Non-visual Components
list in the Component Inspector (since it is not laid out by the layout manager). You can use the same editing features as with a menu bar. To use the popup menu visually, write code like this:popupMenu1.show (component, 100, 100);where you want to show the popup menu. The API documentation that comes with the Java 2 SDK has more details about displaying popup menus in its specifications for PopupMenu and JPopupMenu.
Contents | Prev | Next | Index |