The main or desktop window of an application normally has a menu bar containing menus. Each menu contains menu items. The desktop window listens for user selection of these menu items.
In this example, there is only a single menu (Commands) containing two menu items: Change and Exit. Selecting Commands/Change (or pressing <Alt>ch) causes the disk to switch colors from red to green and back. Selecting Command/Exit (or pressing <Alt>cx) causes the application to terminate:
The code for this application is in DesktopWindow.java.
The file GUIUtils.java contains an interesting utility that simplifies menu creation.