A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Java program to draw a circle
Q:

Java program to draw a circle

0

Java program to draw a circle

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

By using java program, we have to draw a circle.

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;

public class DrawCircle extends Frame 
{
	// input the value for circle and square.
	Shape circle=new Ellipse2D.Float(100.0f,100.0f,100.0f,100.0f);
	
	// class paint to fill color in circle.
	public void paint(Graphics g)
	{
		Graphics2D ga=(Graphics2D)g;
		ga.draw(circle);
		ga.setPaint(Color.blue);
		ga.fill(circle);
	}
		
	public static void main(String args[])
	{
		// create a frame object for circle.
		Frame frame=new DrawCircle();
		frame.addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent we)
			{
				System.exit(0);
		    }
		});
		// circle coordinates.
		frame.setSize(300, 250);
		frame.setVisible(true);	
	}
}

Output

draw a circle using java

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now