How to Draw a circle in Applet java Code example
public static void drawCircle(Graphics g, int i, int j, int k, int l)
{
k += l / 2;
for(int i1 = 0; i1 < l; i1++)
{
drawCircle(g, i, j, k);
if(i1 + 1 < l)
{
drawCircle(g, i + 1, j, k - 1);
drawCircle(g, i - 1, j, k - 1);
drawCircle(g, i, j + 1, k - 1);
drawCircle(g, i, j - 1, k - 1);
k--;
}
}
}
{
k += l / 2;
for(int i1 = 0; i1 < l; i1++)
{
drawCircle(g, i, j, k);
if(i1 + 1 < l)
{
drawCircle(g, i + 1, j, k - 1);
drawCircle(g, i - 1, j, k - 1);
drawCircle(g, i, j + 1, k - 1);
drawCircle(g, i, j - 1, k - 1);
k--;
}
}
}
Comments
Post a Comment