UNB/ CS/ David Bremner/ teaching/ java/ EventApplet.java
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JTextArea;
import java.awt.FlowLayout;
import java.util.Date;
import javax.swing.JScrollPane;

public class EventApplet extends JApplet  implements ActionListener {

    private JButton happy=new JButton("Be Happy");
    private JButton clickme=new JButton("Self Destruct");
    private JTextArea status=new JTextArea(15,20);


    /**
     * Print event text, and event source.
     *
     * @param actionEvent an <code>ActionEvent</code> value
     */


    public void actionPerformed(ActionEvent actionEvent) {
        status.append(actionEvent.getActionCommand()+" "+
                      actionEvent.getSource().hashCode()+"\n");
    }
        


    public void init(){
        getContentPane().setLayout(new FlowLayout());
        getContentPane().add(clickme);
        clickme.addActionListener(this);
        status.setEditable(false);
        status.setLineWrap(true);
        //      getContentPane().add(status);
        getContentPane().add(new JScrollPane(status));
    }

}