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 ...
Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.