import java.awt.*;
import java.applet.Applet;
import java.awt.image.*;

public class app extends java.applet.Applet
 {
  public void init()
   {
    setLayout(new BorderLayout());

    display = new TextField("Press any key!");
    display.setEditable(false);
    add("North", display);

    Panel p = new Panel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER));
    p.add(new Label("Keys to press:"));
    p.add(new Button("Any key"));
    p.add(new Button("Another key"));
    add("South", p);

   }
   
   public boolean handleEvent(Event evt)
   {
    if (evt.id == Event.WINDOW_DESTROY) System.exit(0);
    return super.handleEvent(evt);
   }
   
   public boolean action(Event evt, Object arg)
   {
    if (arg.equals("Any key"))
     { 
      display.setText("You have pressed any key!");
     }

    else if(arg.equals("Another key"))
     {
      display.setText("You have not pressed any key!");
     }

    else return super.action(evt, arg);
    return true;
   }

  private TextField display;
  private boolean start = true;

}
