/** 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(130,90,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(new Color(255,255,150));}          // Change the gray background to yellow.
						      						     			         				     
    /** CREATE THE CURRENT FRAME **/

    public void paint(Graphics g)
       {g.setFont(font);
        g.setColor(new Color(33,94,33));
        g.drawString("A Little Computer Art?",55,25); // Paint text like SimpleApplet1.
	
	g.setColor(brown);
	g.fillRect(0,175,400,25);        // Paint red lamp platform.
	
	g.setColor(Color.red);
	g.drawLine(100,175,100,125);      // Paint red lamp left base.
	g.drawLine(150,175,150,125);      // Paint red lamp right base.
	
	g.setColor(Color.red);
	g.drawArc(70,123,110,30,-63,306); // Paint red lampshade bottom arc.
	g.drawArc(90,60,70,10,0,180);    // Paint red lampshade top arc.
	
	g.setColor(Color.red);
	g.drawLine(70,137,92,63);        // Paint red lampshade left side.
	g.drawLine(180,137,160,64);       // Paint red lampshade right side.
	
	g.setColor(Color.white);
	g.fillArc(65,92,27,27,-105,171);  // Paint lampshade left edge red dot.
	g.fillArc(160,92,26,26,-75,-178);
	
	g.setColor(new Color (0,0,150));
	g.fillOval(95,80,27,27);         // Paint lampshade left center red dot.
	g.fillOval(130,80,27,27);         // Paint lampshade right center red dot.
	
	
	g.setColor(brown);                // This color was defined above.
	g.fillRect(287,160,10,15);        // Paint brown tree trunk.     
	
	g.setColor(new Color (35,142,35));
	g.fillPolygon(poly);              // Paint, complete, and fill green tree.
	
	g.setColor(new Color (0,0,150));
	g.fillOval(289,100,9,10);
	g.fillOval(278,75,8,10);	
	g.fillOval(289,50,6,8);
	g.fillOval(320,115,10,10);
	g.fillOval(260,115,10,10);
	g.fillOval(255,140,10,12);
	g.fillOval(295,145,10,12);
	g.fillOval(315,140,10,12);
	    // Paint, complete, and fill blue ornaments.
	
	g.setColor(new Color (140,0,0));
	g.fillOval(288,25,13,15);	   // Paint, complete, and fill Tree Topper
		
	g.setColor(Color.white);
	g.fillOval(291,28,3,5);
	g.fillOval(295,33,3,5);	    	// Paint, complete, and fill white ornaments.
	g.fillOval(265,100,9,10);
	g.fillOval(300,75,8,10);
	g.fillOval(313,100,9,10);
	g.fillOval(300,125,10,10);
	g.fillOval(280,125,10,10);
	g.fillOval(275,145,10,12);
	
	
	g.setColor(Color.yellow);
        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);
        
	}    
    }

