How to draw circle in Java?
Posted by Paul on April 23rd 2018 13:44 PM
Program to draw a circle in Java : In Java circle can be drawn using java.awt.shape package provided by Java. In this program you will get to know how to draw circle and fill it with color. In program a class is defined as DrawCircle for the circle. This code makes use of Ecllpise2D i.e. in order to specify eclipse float and double. Method : setPaint(): In order to fill the color in circle, this method is used. Here is the code :
Posted by Paul on April 23rd 2018 13:45 PM
Program to draw a circle in Java : Here is another method of drawing a circle using Swing and AWT. Files needed for this program. 1. java.awt.Graphics 2. javax.swing.JFrame 3. java.awt.Color Methods needed from this program : 1. drawOval(): Used to draw the Shape of the Circle / Oval. 2. setColor(): Used to set the Color to be filled inside the Circle / Oval. 3. fillOval(): Used to fill the Color within the Oval shape. Here is the code :