import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

class March30b
{
    public static void main (String [] args)
    {
        JFrame jf = new JFrame("My event-ful program!");
        jf.setSize(500, 500);
        JButton jb1 = new JButton("Click me!");
        JButton jb2 = new JButton("NOO -- click ME!");

        jb2.setForeground (Color.RED);

        jb1.addActionListener (new Clicker());
        jb2.addActionListener (new Clicker());

        jf.add( jb1, BorderLayout.EAST);
        jf.add( jb2, BorderLayout.WEST);
        jf.setVisible(true);
    }
}

class Clicker implements ActionListener
{
    static int counter = 0;
    public void actionPerformed (ActionEvent e)
    {
        counter++;
        System.out.println("Another click! Total = " +
                counter);
    }
}

