JAVA Applet to display a circle using MidPoint Algorithm

import java.applet.*;
import java.awt.*;
public class CircleMidPoint extends Applet{
    int x,y;
    public void paint(Graphics g){
        int h=0,k=0,r = 8;
        int p=1-r;
        int x= 0;
        int y=r;
        do {
            g.drawOval(h+x,k+y,100,100);
            g.drawOval(h+x,k-y,100,100);
            g.drawOval(h-x,k+y,100,100);
            g.drawOval(h-x,k-y,100,100);
            g.drawOval(h+y,k+x,100,100);
            g.drawOval(h+y,k-x,100,100);
            g.drawOval(h-y,k+x,100,100);
            g.drawOval(h-y,k-x,100,100);
            if (p<0){
                p+=2*x+1;
            } else {
                p+=2*(x-y)+1;
                y--;
            }
            x++;
        } while(x<=y);
       
       
    }

}
Reactions

Post a Comment

1 Comments

  1. The Emperor Casino: How to Play and Win with Slots
    Learn 제왕카지노 everything you need to know 온카지노 about The Emperor casino game. หาเงินออนไลน์ There are a host of new games added daily, like slots, roulette, slots and baccarat.

    ReplyDelete