1 /**
2  * The utillib library.
3  * More information is available at http://www.jinchess.com/.
4  * Copyright (C) 2002 Alexander Maryanovsky.
5  * All rights reserved.
6  *
7  * The utillib library is free software; you can redistribute
8  * it and/or modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * The utillib library is distributed in the hope that it will
13  * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with utillib library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21 
22 package free.util;
23 
24 import java.awt.event.WindowEvent;
25 import java.awt.event.WindowAdapter;
26 
27 
28 /**
29  * A WindowListener which calls <code>System.exit(0)</code> when a
30  * <code>WINDOW_CLOSING</code> event occurs on a window it is a listener of.
31  * Add an instance of this class to be a WindowListener of the main frame of
32  * your application.
33  */
34 
35 public class AppKiller extends WindowAdapter{
36 
37 
38   /**
39    * Calls <code>System.exit(0)</code>.
40    */
41 
windowClosing(WindowEvent evt)42   public void windowClosing(WindowEvent evt){
43     System.exit(0);
44   }
45 
46 }
47