Java Swing Tutorials - Herong's Tutorial Examples - v4.31, by Herong Yang
Menu Bar, Menus, Menu Items and Listeners
This chapter provides tutorial notes and example codes on menu bar, menus and menu items. Topics include introduction to JMenuBar, JMenu, and JMenuItem classes; test programs of menu bar, menus and menu items; using radio button and check box menu items; using menu, item, and action listeners; using mnemonics and accelerators on keyboard.
JMenuBar, JMenu, and JMenuItem Classes
JMenuBarTest.java - Menu Bar Test Program
JMenuTest.java - Menu Test Program
JMenuItemTest.java - Menu Item Test Program
JRadioButtonMenuItemTest.java - Radio Button Menu Item Test Program
JCheckBoxMenuItemTest.java - Check Box Menu Item Test Program
javax.swing.event.MenuListener - Menu Listener Interface
JMenuItemActionListenerTest.java - Menu Item Action Listener Test
Item Listener on Radio Button Menu Items
Item Listener on Check Box Menu Items
javax.swing.event.MenuKeyListener - Menu Key Listener Interface
setMnemonic() - Setting Keyboard Mnemonics on Menu Items
setAccelerator() - Setting Keyboard Accelerators on Menu Items
Conclusions:
Sample programs listed in this chapter have been tested with JDK 1.6.0 to JDK 15.
Table of Contents
Introduction of Java Swing Package
Graphics Environment of the Local System
JCheckBox - Swing Check Box Class
JRadioButton - Swing Radio Button Class
JTextField - Swing Text Field Class
JComboBox - Swing Combo Box Class
►Menu Bar, Menus, Menu Items and Listeners
Creating Internal Frames inside the Main Frame
Layout of Components in a Container
JEditorPane - The Editor Pane Class
SwingWorker - The Background Task Worker
AWT (Abstract Windows Toolkit)