import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class Event extends Applet{ private Button theButton; private Label theLabel; public Event(){ setLayout(new BorderLayout()); theButton = new Button("Click Me!!"); theLabel = new Label("Nothing Yet!!"); add("North", theButton); add("South", theLabel); theButton.addActionListener(new MyActionListener()); } protected class MyActionListener implements ActionListener{ public void actionPerformed(ActionEvent e){ theLabel.setText("Clicked!!"); } } /* you could have also implemented an anonymous class like this: theButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ theLabel.setText("Clicked!!"); } }); */ }