To define a GUI action you typically use an
By using an
functionality of a GUI component is separated from the effect it has on the application. Take, for example, a button that
ILcdAction associated to it.
When the button is pressed by the user, the button calls the method
actionPerformed of the
actionPerformed has one argument which specifies the event (user interaction) that was invoked on the button.
It is then the
ILcdAction that defines the effect of this user interaction on the
application. As you can see, the button has no direct effect on the application. It merely serves as a
messenger that forwards user interaction to the application. The same behavior applies to a menu item in a
ILcdAction is an extension of
java.awt.event.ActionListener which applies the Command pattern.
It is very similar to the Swing
javax.swing.Action interface. To create a Swing
Action from a given
ILcdAction you simply create an instance of
TLcdSWAction, which is a Swing wrapper around an
ILcdAction applies the Listener pattern in collaboration with
java.beans.PropertyChangedEvent objects from the
ILcdAction on which
it is registered. For more information on listening to changes, refer to Notifying objects of changes with listeners.
The main implementations of the interface
ILcdAction for GXY views are:
TLcdOpenActionto load an
ILcdModelfrom a file. For more information on configuring an
ILcdActionto load model data, refer to Adding instant data format support to your application.