//cd c:\HPBasic\Toppage-sample3\Applet //javac Doshinen.java //set CLASSPATH=. //appletviewer Doshinen.java //appletviewer Doshinen.html import java.applet.*; import java.awt.*; /* */ public class Doshinen extends Applet { public void paint(Graphics g) { Color[] colors = {Color.magenta, Color.blue, Color.cyan,Color.green, Color.yellow,Color.red,Color.white,Color.black}; Dimension d = getSize(); int xc = d.width/2; int yc = d.height/2; int radius=xc; for (int i=0; i < colors.length; i++) { radius -= 15; g.setColor(colors[i]); System.out.println("i = " + i + " radius = " + radius + " colors" + colors[i]); g.fillOval(xc-radius,yc-radius,2*radius,2*radius); } } } /* i = 0 radius = 135 colorsjava.awt.Color[r=255,g=0,b=255] i = 1 radius = 120 colorsjava.awt.Color[r=0,g=0,b=255] i = 2 radius = 105 colorsjava.awt.Color[r=0,g=255,b=255] i = 3 radius = 90 colorsjava.awt.Color[r=0,g=255,b=0] i = 4 radius = 75 colorsjava.awt.Color[r=255,g=255,b=0] i = 5 radius = 60 colorsjava.awt.Color[r=255,g=0,b=0] i = 6 radius = 45 colorsjava.awt.Color[r=255,g=255,b=255] i = 7 radius = 30 colorsjava.awt.Color[r=0,g=0,b=0] */