import java.awt.*; import java.applet.*; public class snow extends Applet implements Runnable { long moves=0; int place[][]= new int[10000][3]; boolean dots = true; int numberofdots=2000; public void init(){ setBackground(Color.black); } public void start(){ Thread t = new Thread(this); t.start(); for(int a=0; a<=numberofdots; a++){ place[a][0]=0; place[a][1]=10000; place[a][2]=(int)((Math.random()*3)+1); } } public void paint(Graphics g){ moves++; dots=true; for(int a=0;a<=numberofdots;a++){ if(moves % place[a][2]==0){place[a][1]++;} if(place[a][1]>768){ if(dots){ place[a][0]=(int)(Math.random()*1024); place[a][1]=0; place[a][2]=(int)((Math.random()*3)+1); dots=false; g.setColor(Color.white); } } if(place[a][1]<=768){ if(place[a][2]==3){g.setColor(Color.darkGray); } if(place[a][2]==2){g.setColor(Color.gray);} if(place[a][2]==1){g.setColor(Color.lightGray);} g.fillRect(place[a][0],place[a][1],3,3); } } for(int a=0;a<=numberofdots;a++){ } } public void run() { while(true){ repaint(); try{Thread.sleep(5);} catch(InterruptedException e){} } } }