Drawing Circles...

hi everyone,

I have been working on the question below:

(Write an applet that draws six concentric circles spaced 12 pixels apart.

I did the code but its only displaying one circle, its not displaying the rest,,,,i'd like to know why.

import java.awt.*;

import java.applet.*;

publicclass concentricCircleextends Applet{

int h ;

int w ;

publicvoid paint(Graphics g){

for(int i=0;i<=6;i++)

{

h=12;

w= 12;

g.drawOval(h,w,100,100);

}

}

}

thanks

[1082 byte] By [liveurlifea] at [2007-11-26 12:56:48]
# 1
You are drawing six circles of the same size at the same location. Make sure you take note of what the four inputs to drawOval do. You'll need to do the proper calculations to make your circles concentric with the proper difference in radii.
doremifasollatidoa at 2007-7-7 16:52:13 > top of Java-index,Java Essentials,New To Java...
# 2
They are all painting. They are all painting on top of each other.Perhaps you meant to change the x and y co-ordinates based on your loop.
cotton.ma at 2007-7-7 16:52:13 > top of Java-index,Java Essentials,New To Java...
# 3
And you're drawing seven circles (i = 0...6) instead of six. =)Jukka
duckbilla at 2007-7-7 16:52:13 > top of Java-index,Java Essentials,New To Java...