Basic HTML version of Foils prepared March 26 1999

Foil 6 Handling Button Events

From Java Academy:Graphical User Interface NPAC Java Academy February--April 99 -- March 1999. by Nancy McCracken

Applet to show button events
The last step is to connect the button to the actionPerformed method by registering that the applet is the class ready to "listen" for button events: button1.addActionListener ( this ) ;
The keyword this refers to the current applet.
Note that many buttons can add ActionListener and the one actionPerformed method should have code sections for each button.



© 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 Fri Mar 26 1999