/** Assignment:  Modify this file (previously SimpleApplet2)
 ** by adding a few ornaments of your own design to the 
 ** Christmas tree. Also, edit MyApplet5.html in the      
 ** project directory, to run the MyApplet5.class file                                                                  
 ** you create, and to look nice.                        **/
 
/** USE EXISTING JAVA CLASSES **/

import java.awt.*;
import java.applet.Applet;

/** EXTEND THE JAVA APPLET CLASS **/

public class MyApplet5 extends Applet 
   {Font font = new Font("TimesRoman",Font.BOLD,30); // Define and initialize
    Color brown = new Color(128,128,0);	             // MyApplet5 class variables,						     				      
    int xcoords[] = {232,248,243,259,254,270,265,281,276,292, // and arrays.
		     308,303,319,314,330,325,341,336,352};     
    int ycoords[] = {160,135,135,110,110,85,85,60,60,35,
		     60,60,85,85,110,110,135,135,160};
    int numpoints = xcoords.length;
    Polygon poly = new Polygon(xcoords,ycoords,numpoints);
    
    public void init()	
       {setBackground(Color.red);}          // Change the gray background to white.
						      						     			         				     
    /** CREATE THE CURRENT FRAME **/

    public void paint(Graphics g)
       {g.setFont(font);
        g.setColor(Color.black);
        g.drawString("Leah's Tree",225,25); // Paint text like SimpleApplet1.
	
	
	g.setColor(brown);                // This color was defined above.
	g.fillRect(287,160,10,15);        // Paint brown tree trunk.     
	
	g.setColor(Color.green);
	g.fillPolygon(poly);              // Paint, complete, and fill green tree.
        
	g.setColor(Color.red);
	g.drawArc(240,100,100,50,211,125);
	g.drawArc(240,80,100,50,222,103);
	g.drawArc(240,60,100,50,233,80);
	g.drawArc(240,40,100,50,244,56);
	g.drawArc(240,20,100,50,255,37);
	
	g.setColor(Color.blue);
	g.drawOval(245,135,5,5);
	g.fillOval(245,135,5,5);
	g.drawOval(255,125,6,6);
	g.fillOval(255,125,6,6);
	g.drawOval(260,140,7,7);
	g.fillOval(260,140,7,7);
	g.drawOval(237,150,6,6);
	g.fillOval(237,150,6,6);
	g.drawOval(277,120,5,5);
	g.fillOval(277,120,5,5);
	g.drawOval(290,100,7,7);
	g.fillOval(290,100,7,7);
	g.drawOval(270,90,5,5);
	g.fillOval(270,90,5,5);
	g.drawOval(265,110,6,6);
	g.fillOval(265,110,6,6);
	g.drawOval(288,150,7,7);
	g.fillOval(288,150,7,7);
	g.drawOval(333,150,6,6);
	g.fillOval(333,150,6,6);
	g.drawOval(300,140,5,5);
	g.fillOval(300,140,5,5);
	g.drawOval(325,125,7,7);
	g.fillOval(325,125,7,7);
	g.drawOval(310,90,6,6);
	g.fillOval(310,90,6,6);
	g.drawOval(285,60,5,5);
	g.fillOval(285,60,5,5);
	g.drawOval(290,47,6,6);
	g.fillOval(290,47,5,5);
	g.drawOval(280,79,6,6);
	g.fillOval(280,79,6,6);
	g.drawOval(299,80,5,5);
	g.fillOval(299,80,5,5);
	g.drawOval(310,110,6,6);
	g.fillOval(310,110,6,6);
	g.drawOval(300,120,7,7);
	g.fillOval(300,120,7,7);
	g.drawOval(278,138,5,5);
	g.fillOval(278,138,5,5);
	}    
    }

