/** Copyright (c) 1997 Sams.net Publishing. All Rights Reserved.
 ** Teach Yourself Java 1.1, Laura Lemay and Charles L. Perkins. 
 ** Adapted from Listing 9.1:  The Lamp class.     
 **                                                                   
 ** Modified to SimpleApplet2 by John Pais, December 1997.   **/
 
/** 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);	             // SimpleApplet2 class variables,						     				      
    Color fgreen = new Color(35,142,35);
    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.white);
	}          // Change the gray background to white. Set new color
						      						     			         				     
    /** CREATE THE CURRENT FRAME **/

    public void paint(Graphics g)
       {g.setFont(font);
        g.setColor(Color.red); // used to be blue
        g.drawString("A Little Computer Art, Variaton!",15,25); // Paint text like SimpleApplet1.
	
	g.setColor(Color.blue); // used to be red
	g.fillRect(0,175,450,25);        // Paint red lamp platform.
	
	g.setColor(Color.yellow);
	g.fillArc(90,60,70,10,0,180);
	g.setColor(Color.black);
	g.drawArc(70,123,110,30,-63,306);
	g.drawArc(90,60,70,10,0,180);    // Paint purple lampshade top arc.
	g.setColor(Color.yellow);
	g.fillArc(71,124,108,28,-62,305); // Paint purple lampshade bottom arc.
			
	g.setColor(Color.black);
	g.drawLine(70,137,92,63);        // Paint purple lampshade left side.
	g.drawLine(180,137,160,64);       // Paint purple lampshade right side.
	
	g.setColor(Color.black); // used to be yellow
	g.fillArc(65,92,27,27,-105,171);  // Paint lampshade left edge yellow dot.
	g.setColor(Color.blue);
	g.fillOval(95,80,27,27);         // Paint lampshade left center yellow dot.
	g.setColor(Color.black);
	g.fillOval(130,80,27,27);         // Paint lampshade right center yellow dot.
	g.setColor(Color.blue);
	g.fillArc(160,92,26,26,-75,-178); // Paint lampshade right edge yellow dot.
	
	g.setColor(Color.red);
	g.fillRect(100,125,50,50);
	g.drawLine(100,175,100,125);      // Paint purple lamp left base.
	g.drawLine(150,175,150,125);      // Paint purple lamp right base.
	
	g.setColor(brown);                // This color was defined above.
	g.fillRect(287,160,10,15);        // Paint brown tree trunk.     
	
	g.setColor(fgreen);
	g.fillPolygon(poly);              // Paint, complete, and fill green tree.
	
	g.setColor(Color.yellow); //set tinsel
	g.drawArc(280,55,24,10,200,140);
	g.drawArc(255,75,75,50,200,140);
	
	g.setColor(Color.orange); //set ornament
	g.fillOval(270,80,20,20);
	g.setColor(Color.red);
	g.fillOval(276,83,5,5);
        g.fillOval(281,93,5,5);
	
	g.setColor(Color.red);
	g.fillOval(300,90,14,14);
	g.setColor(Color.blue);
	g.fillOval(308,92,6,6);
	g.fillOval(303,95,6,6);

	g.setColor(Color.pink);
	g.fillOval(265,130,15,15);
	g.setColor(Color.black);
	g.fillOval(267,140,5,5);
	g.fillOval(271,136,5,5);

	g.setColor(Color.blue);
	g.fillOval(298,137,13,13);
	g.setColor(Color.pink);
	g.fillOval(301,140,4,4);
		
	g.setColor(Color.green);
	g.fillOval(310,115,15,15);
	g.setColor(Color.red);
	g.fillOval(312,118,3,3);
	g.fillOval(316,123,4,4);
	}    
    }
