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

//
// Author:      Alexander Bogomolny, CTK Software, Inc.
// URL:     http://www.cut-the-knot.com
// Date:    November 30, 2000
// Copyright:   A. Bogomolny
//          Permission to use and modify the file is therefore granted
//          as long as this comment remains unchanged. Do this at your
//          own risk.
//
public class SplineTest extends Applet  implements Runnable
{
       private Thread m_SplineTest = null;

       int m_Width;
       int m_Height;

       SplineTestCanvas m_Canvas;
       SplineTestPanel m_Panel;

    public SplineTest()
    {
    super();
    }

    public String getAppletInfo()
    {
        return "Name: SplineTest - a CTK Applet\r\n" +
               "Author: Alexander Bogomolny";
    }

    public void init()
    {
    super.init();

    Panel panel = new Panel();
        setLayout(new BorderLayout());
        add("Center", panel);
        add("South", new CTKImprint1(this));
        panel.setLayout(new BorderLayout());

    m_Canvas = new SplineTestCanvas(this);
        panel.add("Center", m_Canvas);

    m_Panel = new SplineTestPanel(this);
        panel.add("South", m_Panel);
    }

    public void destroy() {}

    public void start()
    {
        if (m_SplineTest == null)
        {
            m_SplineTest = new Thread(this);
            m_SplineTest.start();
        }
    }

    // The stop() method is called when the page containing the applet is
    // no longer on the screen. The AppletWizard's initial implementation of
    // this method stops execution of the applet's thread.
    //--------------------------------------------------------------------------
    public void stop()
    {
        if (m_SplineTest != null)
        {
            m_SplineTest.stop();
            m_SplineTest = null;
        }
    }

    public void run()
    {
    while (true)
        {
            try
            {
                Thread.sleep(100);
            }
            catch (InterruptedException e)
            {
                // TODO: Place exception-handling code here in case an
                //       InterruptedException is thrown by Thread.sleep(),
                //       meaning that another thread has interrupted this one
            }
        }
    }

    public String[][] getParameterInfo()
    {
    String[][] ParameterInfo =
    {{"WIDTH", "int", "(400 will do)"},
    {"HEIGHT", "int", "(300 will do)"},
    {"FCOLOR", "string", "000000"},
    {"BCOLOR", "string", "c0dcc0"}};

    return ParameterInfo;
    }
}