Adding a button to an applet is just as easy: add( new Button( "Red" ) ); |
This statement adds a button with label "Red" |
The problem is that nothing happens when you press the button! First you must write a "handler" that handles button events |
A button event is a type of event called an ActionEvent |