// This program creates a blank window, and shows how to
// set the size and title. This version shows the use of
// a WindowAdapter class. Since this program doesn't extend
// from any other class, it could extend from WindowAdapter. But
// applets and many other programs will already extend from some
// class or another, so a separate class is needed.
// Written 1999 by Wayne Pollock, Tampa FL USA.
import java.awt.*;
import java.awt.event.*;
public class SimpleGUI3
{ public static void main ( String [] args )
{ Frame myFrame = new Frame();
myFrame.setTitle( "Wonder Window!" );
myFrame.setSize( 250, 100 );
myFrame.setVisible( true );
MyWindowHandler mwh = new MyWindowHandler();
myFrame.addWindowListener( mwh );
}
}
class MyWindowHandler extends WindowAdapter
{ public void windowClosing ( WindowEvent we )
{ System.exit( 0 );
}
}