104
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:
Example of creating Edit menu for Notepad:
Output:
Next TopicJava JPopupMenu