import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class BeepFiveApplet extends Applet {
public void init () {
// Construct the button
Button beep = new Button("Beep");
// add the button to the layout
this.add(beep);
// specify that action events sent by this
// button should be handled by a new BeepAction object
beep.addActionListener(new BeepAction());
beep.addActionListener(new BeepAction());
beep.addActionListener(new BeepAction());
beep.addActionListener(new BeepAction());
beep.addActionListener(new BeepAction());
}
}
When the Button
beep fires an ActionEvent
, each of the five BeepAction
objects receives a copy of the event.
The order they receive it in is not specified.