Click the contextual menu icon under the AWT or Swing tab in the Component Palette.
(Tool tips for these menu icons are PopupMenu and JPopupMenu,
respectively.)
Click anywhere in the form to add the menu. The new menu appears under the Non-visual
Components list in the Component Inspector. You can use the same menu-editing
features that you use with a menu bar.
Write code similar to this where you want to show the contextual menu:
popupMenu1.show (component, 100, 100);
See the API documentation that comes with the Java 2 SDK for more details.