A PopupMenu is similar to a Menu as it contains MenuItem objects.
A PopupMenu is similar to a Menu as it
contains MenuItem objects. The Pop-up Menu can be popped over any
component while generating the appropriate mouse event rather than letting it
appear at the top of a Frame. Menu class can only be added to a Frame and not to
the Applet. To add it to the Applet you need to use the Swing component
In the program code given below, we have used MouseEvent.isPopupTrigger()
method to trigger the MouseEvent that pops up the menu. The
example below shows the triggering of a pop-up menu and its activation
through a command button.