How To Draw A Crescent In Java
How to Create Circle In Java
This is a elementary program of coffee awt. In this section, you will acquire 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 Coffee second definitio
This is a unproblematic programme of java awt. In this department, you will learn how to create Circle Diagram. The java circle is the nigh key abstractions in a Java 2nd in the supported coffee.awt.shape package. It describes a shape. Merely the Java 2D definitio
How to Create Circle In Java

Introduction:
This is a simple program of java awt. In this section, you will learn how to create Circumvolve Diagram. The java circle is the most fundamental abstractions in a Java 2D in the supported coffee.awt.shape package. It describes a shape. But the Java 2d definition of a shape does not require the shape to enclose an surface area. The Java2D API likewise provides several classes that defines common Geometric Objects.
Program Description:
In this program, you will also prove that how to create square drawing. Within the program define a class proper name CircleDraw for the circle component. There is created two types of diagrams "Circle" and "square" for this program. Here, this plan uses Ecllpise2D that is implemented to specify eclipse bladder and double. double and float components are represented for creating the square and circumvolve in this program.
setPaint(): This class is used for filling the colour.
Here is the code of this program:
import java.awt.*;
import java.awt.upshot.*;
import java.awt.geom.*;
public class CircleDraw extends Frame {
Shape circle = new Ellipse2D.Bladder ( 100.0f , 100.0f , 100.0f , 100.0f ) ;
Shape square = new Rectangle2D.Double ( 100 , 100 , 100 , 100 ) ;
public void pigment ( Graphics g ) {
Graphics2D ga = ( Graphics2D ) g;
ga.draw ( circle ) ;
ga.setPaint ( Color.light-green ) ;
ga.fill up ( circle ) ;
ga.setPaint ( Color.red ) ;
ga.draw ( square ) ;
}
public static void chief ( Cord args []) {
Frame frame = new CircleDraw () ;
frame.addWindowListener ( new WindowAdapter (){
public void windowClosing ( WindowEvent we ){
System.exit ( 0 ) ;
}
}) ;
frame.setSize ( 300 , 250 ) ;
frame.setVisible ( true ) ;
}
}
Output this program:
Download this program.
Ads
Source: https://www.roseindia.net/java/example/java/awt/how-to-create-circle-in-java.shtml
Posted by: hammittlever2000.blogspot.com

0 Response to "How To Draw A Crescent In Java"
Post a Comment