Basic HTML version of Foils prepared July 6 99

Foil 43 Event Model - II

From Use of Java Language in Computational Science DoD Modernization Users Group Conference Monterey -- June 7 99. by Nancy McCracken, Geoffrey C. Fox


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.
  • public class EventClass implements ActionListener
  • {
  • public void actionPerformed ( ActionEvent ev )
  • {. . . put code here to respond to event ev . . . }
  • }
Each basic component has a defined Event class, Listener interface, and event handling method names.
Note that an interface is a class in which there are headers of methods with no method body. It just gives the name(s) of methods such as actionPerformed that the user is to provide.



© 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 Tue Jul 6 1999