/*
 * ThermFrame.java    2.0 97/07/08
 * Copyright (c) 1997, B. F. Caviness
 *
 * This software may be copied/modified for any non-commercial educational use.
 */

import java.awt.*;

/**
 * A driver class for the component <code>class Thermometer</code> and its
 * methods.  This uses JDK 1.1 except for the method handleEvent.
 */

 
public class ThermFrame extends Frame
{
 
 /************************************/
 // Every Java application must have a main method
 public static void main(String args[])
 {
  new ThermFrame("Thermometer Display Window"); // Create and display window
 }

 /************************************/
 Thermometer thermometer = new Thermometer();	// Create canvas for painting

 public ThermFrame(String title)
 {
  super(title);				// Call constructor of super class
  add("Center", thermometer);		// Attach canvas component to frame
  resize(250,400);			// Set size of frame container
  show();				// Display the frame
  thermometer.setTitle("Thermometer Demo"); // (Re)set the title & repaint
  thermometer.setTemp(33);		// (Re)set temp & repaint thermometer
 }

 public boolean handleEvent(Event e) // To handle close button events
 {
  switch (e.id)                 // Switch on event id
  {
   case Event.WINDOW_DESTROY:   // Close button case
        System.exit(0);         // exit closes window
        return true;            // Needed to make program compile
   default:
        return super.handleEvent(e); // Pass event to superclass handler
  }
 }

}
 

