/*
 <html>
  <applet code="Test.class" width="300" height="300"></applet>
 </html>
*/

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class Test extends Applet implements ActionListener {
    boolean bool = true;
    public void init() {
        Button but = (Button)add(new Button("2ch"));
        but.addActionListener(this);
    }
    public void actionPerformed(ActionEvent e) {
        if (bool) {
            setBackground(Color.green);
            this.bool = false;
        }
        else {
            setBackground(Color.blue);
            this.bool = true;
        }
        add( new Button("java"));
        validate(); // hehehe
    }
}