GUIEvent
The GUIEvent
object is passed to the actionPerformed() method every time a GUI component
generates an event. A GUIEvent
has two fields, source
and message
. The methods getSource()
and getMessage()
will
return those values. The event’s source is the component that generated the event, the message is a string that describes the
nature of the event.
Method Summary
getSource()
- The getSource() method returns the GUI component that generated the event.
getMessage()
- The getMessage() method returns a string containing a description of the event.
Example
void actionPerformed (GUIEvent e) {
print ("Component: " + e.getSource().getLabel());
print ("Message: " + e.getMessage());
}