//StaticNoise.java import java.awt.*; import javax.swing.*; public class StaticNoise extends JApplet { int count, size; public void init() { String input; input = JOptionPane.showInputDialog( "Enter number of times you want to loop" ); count = Integer.parseInt(input); input = JOptionPane.showInputDialog( "Enter square size of block" ); size = Integer.parseInt(input); } public void paint (Graphics g) { int c, x,y; super.paint( g ); for (int i=1; i<=count; i++) { c = (int)(Math.random()*200)+56; g.setColor(new Color(c,c,c)); //shade of gray /* try { Thread.sleep(10); //int variable. pause in milliseconds } catch (InterruptedException e) { } */ x = (int)(Math.random()*getWidth()); y = (int)(Math.random()*getHeight()); g.fillRect(x,y, size,size); //g.drawLine(x,y, x,y); } } }