O'Reilly logo

Special Edition Using Java 2 Standard Edition by Geoff Friesen, Chuck Cavaness, Brian Keeton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Odds and Ends

This chapter has focused on building a GUI with Swing's windowing toolkit. Components, containers, layout managers, events, and listeners have been emphasized. However, Swing offers additional capabilities that need to be addressed—beginning with actions.

Actions

Actions simplify working with toolbars and menus, by centralizing their action event handling, text, icons, and enabled state. An action is represented by an action object, created from a class that implements the Action interface. For example, the abstract AbstractAction class (located in the javax.swing package) implements this interface. To create an action, either subclass AbstractAction or use an inner class, and override the actionPerformed method. The following code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required