import java.awt.*; import java.awt.event.*; import java.applet.*; public class PixelApplet extends Applet { public static final int IDEAL_WIDTH = 200; public static final int IDEAL_HEIGHT = 200; public void paint(Graphics g) { g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.WHITE); for (int i = 0; i < 1000; i++) { int x = (int) (Math.random() * getWidth()); int y = (int) (Math.random() * getHeight()); g.drawLine(x, y, x, y); } } public static void main(String args[]) { Applet applet = new PixelApplet(); Frame frame = new Frame(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.add(applet); frame.setSize(IDEAL_WIDTH, IDEAL_HEIGHT); frame.show(); } }