1. Java Applets

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

I used JDK version 1.8

import java.applet.*;
import java.awt.Graphics;
import java.awt.Dimension;
<applet code="CenterCircleName.class" width=300 height=500>
public class CenterCircleName extends Applet
public void paint(Graphics g)
int r=100;
String name="NAME";
Dimension d=getSize();
int x = d.width/2;
int y = d.height/2;
g.drawString("w:"+x+" y:"+y,20,20);
int sWidth=g.getFontMetrics().stringWidth(name);


applet that draws a circle

Happy Coding :)