/** 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[] = {170,186,181,197,192,208,203,219,214,230, // and arrays.
		     246,241,257,252,268,263,279,274,290};     
    int ycoords[] = {160,135,135,110,110,85,85,60,60,35,
		     60,60,85,85,110,110,135,135,160};
    /*								      					     				      
    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.black);}          // Change the gray background to white.
						      						     			         				     
    /** CREATE THE CURRENT FRAME **/

    public void paint(Graphics g)
       {g.setFont(font);
        g.setColor(Color.blue);
        g.drawString("My Christmas Tree",100,25); // Paint text like SimpleApplet1.
	
	
	
	g.setColor(brown);                // This color was defined above.
	g.fillRect(226,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.fillOval(250,85,11,11); 
	
	g.setColor(Color.blue);
	g.fillOval(225,75,10,15);
	
	g.setColor(Color.orange);
	g.fillRect(285,160,10,10);
	
	g.setColor(Color.blue);
	g.fillRect(190,145,10,10);
	
	g.setColor(Color.red);
	g.fillOval(200,85,10,10);
	
	g.setColor(Color.yellow);
	g.fillOval(225,29,10,10);
	
	g.setColor(Color.orange);
	g.fillOval(200,115,10,15);
	
	g.setColor(Color.white);
	g.fillRect(250,105,5,7);
	
	g.setColor(Color.white);
	g.fillOval(215,130,8,12);
	
	g.setColor(Color.yellow);
	g.fillOval(264,125,8,12);
	
	g.setColor(Color.red);
	g.fillOval(240,140,10,10);
	
	g.setColor(Color.yellow);
	g.fillOval(215,100,8,8);
	
	g.setColor(Color.blue);
	g.fillOval(245,120,8,8);
        }    
    }

