Javatpoint Logo
Javatpoint Logo

Java JMenuBar, JMenu and JMenuItem

The JMenuBar class is used to display menubar on the window or frame. It may have several menus.

The object of JMenu class is a pull down menu component which is displayed from the menu bar. It inherits the JMenuItem class.

The object of JMenuItem class adds a simple labeled menu item. The items used in a menu must belong to the JMenuItem or any of its subclass.


JMenuBar class declaration

JMenu class declaration

JMenuItem class declaration


Java JMenuItem and JMenu Example

Output:

JAVA Jmenuitem and jmenu 1

Example of creating Edit menu for Notepad:

Output:

JAVA Jmenuitem and jmenu 2
Next TopicJava JPopupMenu





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA