/*
 * 1.1 version.
 */

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

public class ButtonDemoApplet extends Applet
                              implements ActionListener {

    protected Button b1, b2, b3;
    protected static final String DEFAULT = "default";
    protected static final String LARGE = "large";
    protected static final String SMALL = "small";

    public void init() {
        b1 = new Button();
        b1.setLabel("Resize applet Smaller");
        b1.setActionCommand(SMALL);

        b2 = new Button("Resize to Defaults");
        b2.setActionCommand(DEFAULT);

        b3 = new Button("Resize applet Larger");
        b3.setActionCommand(LARGE);

        //Listen for actions on buttons 1 and 3.
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);

        //Add Components to the Applet, using the default FlowLayout. 
        add(b1);
        add(b2);
        add(b3);
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand().equals(SMALL)) {
	    //setSize(200,200);
	    resize(200,200);
        }
        if (e.getActionCommand().equals(DEFAULT)) {
	    resize(400,400);
        } 
        if (e.getActionCommand().equals(LARGE)) {
	    //setSize(600,600);
	    resize(600,600);
        }
	validate();
	repaint(); 
    }
}


