Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

How to Create Circle In Java

                         

Introduction:

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. 

Program Description:

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:

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

public class CircleDraw extends Frame {
  Shape circle = new Ellipse2D.Float(100.0f100.0f100.0f100.0f);
  Shape square = new Rectangle2D.Double(100100,100100);
  public void paint(Graphics g) {
    Graphics2D ga = (Graphics2D)g;
    ga.draw(circle);
    ga.setPaint(Color.green);
    ga.fill(circle);
    ga.setPaint(Color.red);
    ga.draw(square);
    }

  public static void main(String args[]) {
    Frame frame = new CircleDraw();
    frame.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent we){
        System.exit(0);
      }
    });
    frame.setSize(300250);
    frame.setVisible(true);
  }
}

Output this program:

Download this program.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
builb.xml
modified
different uml technolo
excel from java
exponencial
ejb 2 tutorial
two dimensional array
velocity rules engine
JOptionPane.showMessag
Photoshop Textures and
Photoshop Buttons Crys
tree
launch dialog with but
string to integer java
how to convert string
ejb-jar.xml file probl
MySQL User Interface
line count
conversion of decimal
How to restore page vi
count line
Replace an object with
JFrame extendedState
JFrame.extendedState
create jsp tag
hide file
PHP Date and .....:/pw
<html: option /> in st
source code of control
rmi
jsf table
Retrieving Data From d
decimal to binary conv
extendedState
js tag
password java databa
Arrays
treemap with comparabl
jsf set href
a comple progrma using
Javascript Mouse Trick
space char
remote
How to write JSP
format decimal
Photoshop Text Effects
Photoshop Web Graphics
clear grid
Scrollbar for JList
why struts 1.1
coding
increase size of strut
ga me s
java program for permu
retereive an image fro
decimal to ANSI
Integer.ParseInt java
xform example
define functions in js
how to pass same varia
Integer.ParseInt examp
first application of s
Mylyn
Quick Sort
working with combobox
passing images to jsp
factory
breakะ????ะ???ะ?
HTML table in java
simple appet
reads data into text f
Changelanguageaccordin
url rewriting
getter setter methods
DynaAction Form
LSB of String java
jasper reports using j
Create Scroll Bar in J
struts2 tag
array element
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.