home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java 1.2 How-To
/
JavaHowTo.iso
/
3rdParty
/
Gamelication
/
com
/
next
/
gt
/
WindowDestroyer.java
< prev
Wrap
Text File
|
1998-04-15
|
590b
|
29 lines
package com.next.gt;
import java.awt.*;
import java.awt.event.*;
/**
Utility class whose objects exit when the attached window is closed.
*/
public class WindowDestroyer extends WindowAdapter {
private Gamelication owner;
private Frame mainScreen;
public WindowDestroyer( Frame gamelicationFrame , Gamelication owner ) {
mainScreen = gamelicationFrame;
this.owner = owner;
}
public void windowClosing(WindowEvent e) {
if( e.getWindow() == mainScreen ) {
owner.stop();
System.exit(0) ;
}
else
e.getWindow().dispose();
}
}