FileDocCategorySizeDatePackage
WindowCloser.javaAPI DocExample1063Thu May 29 14:06:32 BST 2003com.darwinsys.swingui

WindowCloser

public class WindowCloser extends WindowAdapter
A WindowCloser - watch for Window Closing events, and follow them up with setVisible(false), dispose(), and optionally ends (it all) with a System.exit(0).

deprecated
For simple closing, just use JFrame.setDefaultCloseOperation().
author
Ian F. Darwin
version
$Id: WindowCloser.java,v 1.7 2003/05/29 18:06:31 ian Exp $

Fields Summary
Window
win
The window we are to close
boolean
doExit
True if we are to exit as well.
Constructors Summary
public WindowCloser(Window w)
Construct a WindowCloser that doesn't exit, just closes the window


	           
	   
		this(w, false);
	
public WindowCloser(Window w, boolean exit)
Construct a WindowCloser with control over whether it exits

		win = w;
		doExit = exit;
	
Methods Summary
public voidwindowClosing(java.awt.event.WindowEvent e)
Called by AWT when the user tries to close the window

		win.setVisible(false);
		win.dispose();
		if (doExit)
			System.exit(0);