Draw Circles and Ellipses in Java Applet

In Java, the Graphics class doesn’t have any method for circles or ellipses. However, the drawOval() method can be used to draw a circle or an ellipse. Ovals are just like a rectangle with overly rounded corners.
The drawOval() method takes four arguments: the first two represent the top-left corner of the imaginary rectangle and the other two represent the width and height of the oval itself.

Note: If the width and height are the same, the oval becomes a circle. The oval’s coordinates are the coordinates of an enclosing rectangle.


import java.awt.*;
import java.applet.*;
public class circle extends Applet
 public void paint(Graphics g)

         <applet code = "circle.class" width = "480" height = "360"></applet>

Draw Circles and Ellipses  in Java Applet