001 package com.croftsoft.core.gui; 002 003 import java.awt.*; 004 import java.awt.event.*; 005 006 /********************************************************************* 007 * 008 * @version 009 * 1998-11-01 010 * @author 011 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 012 *********************************************************************/ 013 014 public class ExitOnClosingWindowAdapter extends WindowAdapter 015 ////////////////////////////////////////////////////////////////////// 016 ////////////////////////////////////////////////////////////////////// 017 { 018 019 public void windowClosing ( WindowEvent windowEvent ) 020 ////////////////////////////////////////////////////////////////////// 021 { 022 Window window = windowEvent.getWindow ( ); 023 window.dispose ( ); 024 System.exit ( 0 ); 025 } 026 027 ////////////////////////////////////////////////////////////////////// 028 ////////////////////////////////////////////////////////////////////// 029 }