//Brad Culberson 04.23.98
//Prints circles filled and not filled in different colors-- all random.

import java.awt.*;
import java.applet.Applet;

public class MyApplet8 extends Applet 
   {final int maxnumspots = 50;                     
    final int maxnumevents = maxnumspots + 1;       
    int xevent[] = new int[maxnumevents];           
    int yevent[] = new int[maxnumevents];           
    int arval[] = new int[maxnumevents];
    int agval[] = new int[maxnumevents]; 
    int abval[] = new int[maxnumevents]; 
    {for (int i = 0; i < maxnumspots; i++)
	{   arval[i] =(int) Math.floor(Math.random()*256);     
	    agval[i] =(int) Math.floor(Math.random()*256);     
	    abval[i] =(int) Math.floor(Math.random()*256);
	}
	}
	    
    int curevent = 0;                             
						     
    public void init()	                             
       {setBackground(Color.white);}          
    
     public boolean mouseDown(Event e, int x, int y)
	{if (curevent < maxnumevents)                
	  {addspot(x,y);                             
	   return true;}                             
	 else                                       
	  {return false;}      
	 }
     
     void addspot(int x, int y)
	{xevent[curevent] = x;                      
	 yevent[curevent] = y;                       
	 curevent++;                                 
	 repaint();                                 
	 }

    public void paint(Graphics g)
       {int rval, gval, bval;
	for (int i = 0; i < curevent; i++)    
	  {if (i < maxnumspots)             
	    {
	
		g.setColor(new Color(arval[i],agval[i],abval[i]));
		{if (arval[i] < agval[i])
		{g.drawOval(xevent[i],yevent[i],maxnumspots-i,maxnumspots-i);}
		else
		{g.fillOval(xevent[i],yevent[i],maxnumspots-i,maxnumspots-i);}}
		}
	
	   else                                                
	    {g.setColor(Color.black);        
	     g.drawString("Javaneese is cool.",xevent[i],yevent[i]);} 
	   }
	}
    }		 
