What is "jmenu"

JMenu is an implementation of a menu in java-swing - a popup window containing JMenuItems that is displayed when the user selects an item in the JMenuBar. Besides JMenuItems, one JMenu may also contain JSeparators.

In essence, a menu is a button with a JPopupMenu associated. When the "button" is pressed, JPopupMenu appears. If the "button" is in the JMenuBar, the menu is a top level window. If the "button" is another menu item, then the menu JPopupMenu is "pull-right".

Menus can be configured, and to some extent controlled, by Actions. Using an Action with a menu has many benefits besides directly configuring a menu.

The Menu Component Hierarchy

Here is a screenshot of the inheritance hierarchy for the menu-related classes:

inserir a descrição da imagem aqui

As the figure shows, menu items (including other menus) are simply buttons. You may be wondering how a menu, if it’s just a button, shows your menu items. The answer is that when a menu is activated, it automatically brings up a pop-up menu that displays menu items.

For information and examples of use menus, see How to Use Menus, a section in the Java Tutorial.