Chris Johnson, Index
Event Handling - Adapter Classes
/*
* Simple warning program
* Author: Chris Johnson (johnson@dcs.gla.ac.uk)
* Last revision date: 5/1//99
 */
 
import java.awt.*;
import java.awt.event.*;
 
public class CloseableSimpleWarning2 extends Frame
{
static private final int frame_height = 150;
static private final int frame_width = 250;
 
       public CloseableSimpleWarning2()
        {

		\\ Adapter class used here************
         	addWindowListener(new WindowAdapter()
          	{
            		public void windowClosing(WindowEvent e)
             			{System.exit(0);}
          	});
 
        	setBackground(Color.red);
        	setForeground(Color.black);
        	setTitle("Warning");
        	setSize(frame_width, frame_height);
 
	}
 
	public static void main(String [] args)
        {
                CloseableSimpleWarning2 f = new CloseableSimpleWarning2();
                f.show();
        }
}

forward