import import import public
java.awt.*; //required for programs that draw javax.swing.*; //required for Swing applets java.util.Random; class Linespiral extends JApplet {
public void paint(Graphics g) { super.paint(g); Random r=new Random(); g.setColor(Color.red); int k=1,x1=300,y1=300,x2=300,y2=305; for (int i=1;i<=26;i++) {g.setColor(new Color(r.nextInt(256),r.nextInt(256),r.nextInt(256))); g.drawLine(x1,y1,x2,y2); x1=x2; y1=y2; x2=x2-5*k; k=k+1; for (int m=1;m<=70000000;m++); g.setColor(new Color(r.nextInt(256),r.nextInt(256),r.nextInt(256))); g.drawLine(x1,y1,x2,y2); x1=x2; y1=y2; y2=y2-5*k; k=k+1; for (int m=1;m<=70000000;m++); g.setColor(new Color(r.nextInt(256),r.nextInt(256),r.nextInt(256))); g.drawLine(x1,y1,x2,y2); x1=x2; y1=y2; x2=x2+5*k; k=k+1; for (int m=1;m<=70000000;m++); g.setColor(new Color(r.nextInt(256),r.nextInt(256),r.nextInt(256))); g.drawLine(x1,y1,x2,y2); x1=x2; y1=y2; y2=y2+5*k; k=k+1; for (int m=1;m<=70000000;m++); } Dimension appletSize = super.getSize(); int appletHeight = appletSize.height; int appletWidth = appletSize.width; g.drawString("This applet is " + appletHeight + " pixels high by " + appletWidth + " pixels wide.", 15, appletHeight-10); } }