Infolinks In Text Ads

Jun 26, 2010

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;
            }
        }

    }

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...