// JSwat Tutorial example program.
// $Author: nfiedler $ $Date: 2002-10-13 00:03:33 -0700 (Sun, 13 Oct 2002) $ $Rev: 604 $

import java.awt.*;
import java.awt.event.*;

public class tutorial implements ActionListener {
    /** Number of times the button was pushed. */
    protected int pushCount;

    public void actionPerformed(ActionEvent e) {
        pushCount++;
        Button button = (Button) e.getSource();
        StringBuffer label = new StringBuffer("Pushed ");
        label.append(Integer.toString(pushCount));
        label.append(" times");
        button.setLabel(label.toString());
    }

    protected Frame buildWindow(String title) {
	Frame fr = new Frame(title);
        fr.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
		    System.exit(0);
		}
	    });
        fr.setSize(150, 100);
        return fr;
    }

    public static void main(String[] args) {
        System.out.println("Hello world!");
        tutorial me = new tutorial();
        Frame frame = me.buildWindow("tutorial");
        Button button = new Button("Push me");
        button.addActionListener(me);
        frame.add(button);
        frame.show();
    }
}
