//******************************************************************************
// Triangulate.java:	Applet
//
//******************************************************************************
import java.applet.*;
import java.awt.*;

//==============================================================================
// Main Class for applet Triangulate
//
//==============================================================================

public class Triangulate extends Applet
{
	// THREAD SUPPORT:
	//		m_Triangulate	is the Thread object for the applet
	//--------------------------------------------------------------------------
	private Thread	 m_Triangulate = null;
	private int leg = 400;
	private int startx = 200;
	private int starty = 400;
	private Triangle triangle= new Triangle(new dPoint(startx,starty),
											new dPoint(.5*leg+startx,-Math.sqrt(leg*leg-(leg*leg/4))+starty),
											new dPoint(leg+startx,starty));
	private Star star=new Star(triangle);

	// Triangulate Class Constructor
	//--------------------------------------------------------------------------
	public Triangulate()
	{
		// TODO: Add constructor code here
	}

	// APPLET INFO SUPPORT:
	//		The getAppletInfo() method returns a string describing the applet's
	// author, copyright date, or miscellaneous information.
    //--------------------------------------------------------------------------
	public String getAppletInfo()
	{
		return "Name: Triangulate\r\n" +
		       "Author: George Recinos\r\n" +
		       "Created with Microsoft Visual J++ Version 1.1";
	}


	// The init() method is called by the AWT when an applet is first loaded or
	// reloaded.  Override this method to perform whatever initialization your
	// applet needs, such as initializing data structures, loading images or
	// fonts, creating frame windows, setting the layout manager, or adding UI
	// components.
    //--------------------------------------------------------------------------
	public void init()
	{
        // If you use a ResourceWizard-generated "control creator" class to
        // arrange controls in your applet, you may want to call its
        // CreateControls() method from within this method. Remove the following
        // call to resize() before adding the call to CreateControls();
        // CreateControls() does its own resizing.
        //----------------------------------------------------------------------
    	resize(800, 600);

		// TODO: Place additional initialization code here
	}

	// Place additional applet clean up code here.  destroy() is called when
	// when you applet is terminating and being unloaded.
	//-------------------------------------------------------------------------
	public void update(Graphics g)
	{
		paint(g);
	}

	public void destroy()
	{
		// TODO: Place applet cleanup code here
	}

	// Triangulate Paint Handler
	//--------------------------------------------------------------------------
	public void paint(Graphics g)
	{
		// TODO: Place applet paint code here
		g.setColor(Color.black);
		star.draw(g);
	}

	//--------------------------------------------------------------------------
	// TODO: Place additional applet code here


}
