Category: Swing Components Basics

Sending Change Events in Swing

Sending Change Events in Swing

Swing uses two different change event classes. The first is the standard java.beans.PropertyChangeEvent class. This class passes a reference to the object, sending the change notification as well as the property name, its old...

Graphics Environments

Graphics Environments

SDK 1.4 recognizes a great deal of information about its environment. You can retrieve that information for your own code through the GraphicsEnvironment, GraphicsDevice, and GraphicsConfiguration classes from the java.awt package. While they aren’t...

Graphical Interface Events

Graphical Interface Events

Whenever you interact with your application’s user interface, the application receives an event from the windowing system to let it know that something happened. Some events come from the mouse, such as mouse clicks,...

Using an Action

Using an Action

This example creates an Action for both a menu item and a toolbar, displaying both components and allowing the user to click on either one. When the components are clicked, the actionPerformed( ) method...

Constructors

Constructors

The constructors for the AbstractAction object can be used to set the name and icon hashtable properties of the action under the NAME or SMALL_ICON keys, respectively.

Events

Events

The AbstractAction class fires a PropertyChangeEvent when any property in the hashtable is changed or when the action is enabled or disabled. Add or remove the specified PropertyChangeListener from the event listener list.

Properties

Properties

The AbstractAction class stores its keyed properties in a Hashtable object. Beyond that, the AbstractAction object contains a few properties, as shown in following table. The enabled property defines whether the application can invoke...

The AbstractAction Class

The AbstractAction Class

The AbstractAction class is an abstract implementation of the Action interface. AbstractAction provides the default functionality for almost all methods in the Action interface. You can extend this class to create your own specific...

Understanding Actions

Understanding Actions

Actions are a popular addition to Swing. An action allows a programmer to bundle a commonly used procedure and its bound properties (such as its name and an image to represent it) into a...