Chapter 8 Examples


 
Menus
Menus.java creates a menu with images, custom icons, and a tree component. Images from the images directory are used. In the Java 2 version the tree menu item no longer works properly.
 
Menu Events
Menus.java uses an ActionListener and MenuListener to receive notifications of menu item selections and menu expansions. Updated from the book to support a change in the spelling of a MenuListener method.
 
Menus and Actions
MenusActions.java demonstrates how Actions are associated with menu items, and can be used to enable or disable a menu item. A QuitAction object defined in QuitAction.java is used to handle the quit menu item. This example was updated from the book to use the new Action getValue and putValue methods. We also fixed an error that used Buttons instead of JButtons on the window.
 
Menu Shortcuts
MenuShort.java demonstrates how shortcuts are used to support mouseless operation. Updated from the book to support accelerators and mnemonics. The quit menu uses an accelerator, while the other menus use mnemonics.
 
Popup Menu
Popup.java demonstrates how support a popup menu on a component.
 
Toolbars
Toolbars.java demonstrates how to create a tool bar using Actions. The Actions were updated from the book to use putValue.


Copyright © 1998, John Wiley and Sons, Inc.