import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class sSwing2 {
	public static void main(String argv[]) {
		JFrame f = new JFrame("simple Swing");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Container container = f.getContentPane();
		container.setLayout(new GridLayout(0, 1));
		JButton b1 = new JButton("click me!");
		container.add(b1);
		JButton b2 = new JButton(".. or me!");
		container.add(b2);

		myListener myL = new myListener();
		
		b1.addActionListener( myL );
	 	b2.addActionListener( myL );
		
		f.setLocation(300, 50);
		f.setSize(150, 200);
		f.setVisible(true);
	} //main()
} //class sSwing2

class myListener implements ActionListener {
	public void actionPerformed(ActionEvent e) {
		System.out.println("Action handled by thread "+Thread.currentThread().getName() );
	} //actionPerformed()
} //class myListener
	