import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class InnerBeepApplet extends Applet { public void init () { // Construct the button Button beep = new Button("Beep"); // add the button to the layout add(beep); // specify that action events sent by this // button should be handled by a new BeepAction object // that is, register the beep action with this button beep.addActionListener(new BeepAction()); } class BeepAction implements ActionListener { public void actionPerformed(ActionEvent e) { Toolkit.getDefaultToolkit().beep(); } } }