Basic HTML version of Foils prepared 13 October 97

Foil 35 The Event Classes

From Java Tutorial, July 1, 1996 CSC499(JSU) CPS406/606 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox

API for class Event
1 Every event has a source object, obtained by getSource(), and a type value, obtained by getID(). In the case of buttons, the ID is ACTION_PERFORMED. Other Events may have more than one type of event ID.
2 Event subclasses also have methods for whatever data is needed to handle the event. For example, ActionEvent has a method paramString() which for buttons, returns the string labelling the button. MouseEvent has methods getX() and getY(), which return the x and y pixel location of the mouse, and getClickCount().

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 Wed Apr 1 1998