Thursday, 5 January 2017

Practical 1:Develop an applet that draws a circle.The dimension of the applet should be 500 * 300 pixels the circle Should be centered the applet and have a radius of 100 pixels.Display your name centered in a circle(using drawOval method)


Code:


import java.applet.Applet;
import java.awt.Graphics;


/**
 *
 * @author Queue
 */


public class Practical1 extends Applet {

    
    public void init()
    {
        super.init();
        setSize(350,350);
    }
    
    public void paint(Graphics s)
    {
     s.drawOval(50, 50, 200, 200);
     s.drawString("Sherlock", 140, 150);
    }

}

Output:


Thanks ;)

Happy Coding







5 comments: