FileDocCategorySizeDatePackage
nestedCircles.javaAPI DocExample1015Tue Aug 08 17:24:44 BST 2000None

nestedCircles

public class nestedCircles extends Applet

Fields Summary
private int
circleXPosition
private int
circleYPosition
private int
diameter
Constructors Summary
Methods Summary
public voidpaint(java.awt.Graphics g)

	
		// initialise to position of largest circle									
		circleXPosition = 0 ;
		circleYPosition = 0 ;
		
		// set the colour
		g.setColor(Color.green) ;
		
		for (diameter = 200 ; diameter > 0 ; diameter -= 20)
		{
			// draw the circle for this iteration
			g.drawOval(circleXPosition,circleYPosition,diameter,diameter) ;
			
			// update the circle position ready for next time
			circleXPosition = circleXPosition + 10 ;
			circleYPosition = circleYPosition + 10 ;
			
		}