Basic HTML version of Foils prepared Sept 21 1998

Foil 33 The AWT Event Model

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken


1 An Event Listener is an instance of any class that wants to receive events.
2 An event source is an object that generates events. An event source will keep a list of event listeners who want to be notified for particular events.
3 The event source notifies event listeners by invoking a particular method of the event listener (aka the event handler method) and passing it an Event object, which has all the information about the event.
4 For example, a component with a button is an event source, which generates an event called ActionEvent. There must be a class which implements an interface called ActionListener and which is on the list of listeners for that button. Then the Java system will provide the mechanism that passes the ActionEvent to a standard method of the ActionListener interface, namely a method called actionPerformed(). This method will receive the event object and carry out the response to the event.

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998