import java.awt.*; class star { int x,y,v,w,h,R,r,g,b,lim,size; double ra; public star(int w, int h){ this.w = w; this.h = h; if (w > h) lim = w/2; else lim = h/2; init(); } public void init(){ size = (int)(Math.random()*2)+1; if (size == 2) size = 3; v = (int)(Math.random()*(lim/10))+size; ra = (Math.random()*2*Math.PI); R= (int)(Math.random()*lim/4); x = (int)(w/2+R*Math.cos(ra)); y = (int)(h/2+R*Math.sin(ra)); r = (int)(Math.random()*4); g = (int)(Math.random()*4); b = (int)(Math.random()*4); } public void paint(Graphics off_g,Color color[][][]){ off_g.setColor(color[r][g][b]); off_g.fillOval(x-(size/2),y-(size/2),size,size); R += v; x = (int)(w/2+R*Math.cos(ra)); y = (int)(h/2+R*Math.sin(ra)); if (x < 0 || x > w || y < 0 || y > h) init(); } }