/*
 * Author: Paul Koshevoy
 * Program3.java  Wed Oct 29 14:10:00 1997
 */

import java.awt.*;
import java.awt.event.*;
import java.applet.*;

//----------------------------------------------------------------
// TestProgram
// 
public class TestProgram extends Applet implements ActionListener
{
  private TVtest tv;
  
  //----------------------------------------------------------------
  // init
  // 
  public void init()
  {
    setLayout(new FlowLayout());
    Dimension DIM = getSize();
    Parameters params = new Parameters(getValueD(getParameter("D1")),
				       getValueD(getParameter("S2")),
				       (getValueD(getParameter("G1")) /
					((double)(360)) * (2.0f * Math.PI)),
				       getValueD(getParameter("HT")),
				       getValueD(getParameter("a")),
				       getValueD(getParameter("b")));
    tv = new TVtest(DIM.width,
		    DIM.height,
		    getImage(getDocumentBase(), getParameter("picture")),
		    params);
    add(tv);
  }

  //----------------------------------------------------------------
  // getValue
  // 
  // Some code to extract an integer value from a TextField
  // This function is not mine, I've got it from the sample file
  public int getValue(TextField textField)
  {
    int f;
    try
    {
      f = (int) Double.valueOf(textField.getText()).doubleValue();
    }
    catch(java.lang.NumberFormatException e)
    {
      f = 0;
    }
    return f;
  }
  
  
  //----------------------------------------------------------------
  // getValueD
  // 
  public double getValueD(String str)
  {
    double f;
    try
    {
      f = Double.valueOf(str).doubleValue();
    }
    catch(java.lang.NumberFormatException e)
    {
      f = 0;
    }
    return f;
  }
  
  
  //----------------------------------------------------------------
  // getValueI
  // 
  public int getValueI(String str)
  {
    double f;
    try
    {
      f = Double.valueOf(str).doubleValue();
    }
    catch(java.lang.NumberFormatException e)
    {
      f = 0;
    }
    return ((int)(f));
  }
  
  
  //----------------------------------------------------------------
  // actionPerformed
  // 
  // Event handling code
  public void actionPerformed(ActionEvent event) {}
}

