This is a simple program of java awt. In this section, you will learn how to create Circle Diagram. The java circle is the most fundamental abstractions in a Java 2D in the supported java.awt.shape package. It describes a shape. But the Java 2D definition of a shape does not require the shape to enclose an area. The Java2D API also provides several classes that defines common Geometric Objects.
In this program, you will also show that how to create square drawing. Inside the program define a class name CircleDraw for the circle component. There is created two types of diagrams "Circle" and "square" for this program. Here, this program uses Ecllpise2D that is implemented to specify eclipse float and double. double and float components are represented for creating the square and circle in this program.
setPaint(): This class is used for filling the color.
Here is the code of this program:
Output this program:
Liked it! Share this Tutorial