import java.awt.event.*;
import javax.swing.*;

/**
 * @author Remi Forax
 *
 */
public class FirstExample {

  static class MyActionListener implements ActionListener {
    public void actionPerformed(ActionEvent event) {
      System.out.println(event); 
    }
  }

  public static void main(String[] args) {
        
    JPanel panel=new JPanel();
    JButton button=new JButton("Test");
    
    ActionListener l=new MyActionListener();
    button.addActionListener(l);
    
    panel.add(button);

    JFrame frame=new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(panel);
    frame.setSize(300,200);
    frame.show();
  }
}
