import java.awt.event.*;

import javax.swing.*;

/**
 * @author Remi Forax
 *
 */
public class WindowExample {

  public static void main(String[] args) {
    final JFrame frame=new JFrame("WindowExample");
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosed(WindowEvent e) {
        System.out.println("arg, je meurs");
      }

      public void windowClosing(WindowEvent e) {
        frame.dispose();
      }
    });
    frame.setSize(400,300);
    frame.show();
  }
}
