How to Draw Oval in Applet Java Code example

public static void drawOval(Graphics g, int i, int j, int k, int l, int i1)
    {
        if(i1 == 1)
        {
            g.drawOval(i, j, k, l);
            return;
        }
        i -= i1 / 2;
        j -= i1 / 2;
        k += i1;
        l += i1;
        for(int j1 = 0; j1 < i1; j1++)
        {
            g.drawOval(i, j, k, l);
            if(j1 + 1 < i1)
            {
                g.drawOval(i, j, k - 1, l - 1);
                g.drawOval(i + 1, j, k - 1, l - 1);
                g.drawOval(i, j + 1, k - 1, l - 1);
                g.drawOval(i + 1, j + 1, k - 1, l - 1);
                i++;
                j++;
                k -= 2;
                l -= 2;
            }
        }

    }

Comments

Recent Post

Recent Posts Widget

Popular posts from this blog

Capture image from webcam java code, examples

How to capture finger prints in java

Shallow Copy Deep Copy Java example