<HTML> <BODY> <P> <CENTER> <applet code="Target.class" width=400 height=300> </applet> </CENTER> </P> </BODY> </HTML>
// Scott DeRuiter 2/25/2003 // Target.java // Draws some circles to form a target. import java.awt.*; import java.applet.Applet; public class Target extends Applet { public void paint ( Graphics g ) { for ( int i = 1; i <= 6; i++ ) { switch ( i ) { case 1: g.setColor ( Color.blue ); break; case 2: g.setColor ( Color.black ); break; case 3: g.setColor ( Color.green ); break; case 4: g.setColor ( Color.gray ); break; case 5: g.setColor ( Color.yellow ); break; case 6: g.setColor ( Color.red ); break; } g.fillOval ( i * 20, i * 20, 300 - (i * 40), 300 - (i * 40) ); } } }