Menus
If you're creating a program that uses a frame, you can jazz it up with a menu bar, a set of pull-down menus that is usually displayed below the title bar.
Menus in Java are created using three components: JMenuBar, JMenu, and JMenuItem.
A JMenuItem component is an item on a menu. It serves the same purpose as a button—click an item to make something happen.
A JMenu container holds JMenuItem components, lines that separate menu items, and other interface components, such as check boxes.
A JMenuBar container holds JMenu components, displaying their names.
These three work together more closely than members of the Osmond Family. For example, you could put an Exit button on a menu so users can exit the program.
This button could be put in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access