  // A Button Events Application

  import java.applet.*;
  import java.awt.*;
  import java.awt.event.*;

  public class ButtonEvents extends Applet implements ActionListener
  {
	
	private Button button1, button2, button3;
	private TextField status;
	
	public void init()
	{
	  status = new TextField(20);

	  this.button1 = new Button("Button 1");
	  this.button2 = new Button("Button 2");
	  this.button3 = new Button("Button 3");

	  this.button1.addActionListener(this);
	  this.button2.addActionListener(this);
	  this.button3.addActionListener(this);

	  this.add(status);
	  this.add(button1);
	  this.add(button2);
	  this.add(button3);
	}
	
	public void actionPerformed(ActionEvent e)
	{
	  if (e.getActionCommand().equals("Button 1"))
	  {
	    status.setText("Button 1 Pressed");
	  }
	  else if (e.getActionCommand().equals("Button 2"))
	  {
	    status.setText("Button 2 Pressed");
	  }
	  else
	  {
	    status.setText("Button 3 Pressed");
	  }
	}
  }