Draw oval in JFrame

Source code below will show you, how to draw an oval in a JFrame

*************************************************************
COMPLETE SOURCE CODE FOR : DrawOvalInJFrame.java
*************************************************************


import javax.swing.JFrame;

import java.awt.Graphics;
import java.awt.Color;

public class DrawOvalInJFrame extends JFrame
{
public DrawOvalInJFrame()
{
//Set JFrame title
super("Draw An Oval In JFrame");

//Set default close operation for JFrame
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Set JFrame size
setSize(400,400);

//Make JFrame visible
setVisible(true);
}

public void paint(Graphics g)
{
super.paint(g);

//draw oval outline
g.drawOval(50,50,100,300);

//set color to RED
//So after this, if you draw anything, all of it's result will be RED
g.setColor(Color.RED);

//fill oval with RED
g.fillOval(50,50,100,300);
}

public static void main(String[]args)
{
DrawOvalInJFrame dlijf=new DrawOvalInJFrame();
}
}


*************************************************************
JUST COMPILE AND EXECUTE IT
*************************************************************

RELAXING NATURE VIDEO