Basic HTML version of Foils prepared March 26 1999

Foil 4 Button

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


Adding a button to the applet is just as easy: Button button1 = new Button ( " Blue " ) ; add ( button1 ) ;
These statements add a button labelled Blue.
But nothing will happen when you press the button!
Pressing the button is called an event. You must add a "handler" method that is executed when a button event occurs.
A button event is a type of event called an ActionEvent in Java.



© 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