Basic HTML version of Foils prepared June 5 99

Foil 57 Event Model - II

From Java Language in the Computer Science Curriculum ADMI Tutorial Duluth Minnesota -- June 3 99. by 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 Sat Jun 5 1999