   import javax.swing.*;
   import java.awt.*;

   public class Forme extends JApplet{
   
    Display disegno;
      Forma[] forma;
      int k = (int)((Math.random()*100)); //numero forme da 1 a 100
   
      public void init(){
	disegno= new Display();
	setContentPane(disegno);         
      forma = new Forma[k];
         for(int i = 0;i<k;i++){
            forma[i] = new Forma((int)(Math.random()*2),               (int)(Math.random()*getSize().width),
               (int)(Math.random()*getSize().height), 
               (int)(Math.random()*((getSize().width+getSize().height)/8)), 
               (int)(Math.random()*255),  
               (int)(Math.random()*255),  
               (int)(Math.random()*255)); 
         }
      }
	class Display extends JPanel {
      public void paintComponent(Graphics g){
         for(int i=0;i<k;i++){
            forma[i].disegno(g);
         }
      }
}
      
   }
