Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Arcs Drawing In Java 
 

In this section, you will learn how to create arcs diagram in java awt package. The Java program uses Arcs2D class, arcs2D is the abstract superclass for all objects that store a 2D arc defined by a bounding rectangle, start angle, angular extent and a cl

 

Arcs Drawing In Java

                         

Introduction:

In this section, you will learn how to create arcs diagram in java awt package. The Java program uses Arcs2D class, arcs2D is the abstract superclass for all objects that store a 2D arc defined by a bounding rectangle, start angle, angular extent and a closure type. Here, you wll see in the given following example that provides you the complete code of the program. 

Program Description:

The following program shows a frame title with "Arcs Draw". In this program you will also see how to show arcs diagram on the frame. There is two diagram you will see on frame, blank and color fill diagram. In this program we are using the BasicStroke() method. You can learn about this method in the previous program. Here, this program is using the "Arcs2D.Double" class. This class represent an arc defined by a bounding rectangle and closure type.

Here is the code of this program:

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

public class ArcsDraw extends Frame {
  Stroke drawingStroke = new BasicStroke(2);
  Arc2D arc=new Arc2D.Double(1409090145160180,  Arc2D.OPEN);
  Arc2D arc1=new Arc2D.Double(100509060140160,  Arc2D.OPEN);
                         
  public void paint(Graphics g) {
    Graphics2D ga = (Graphics2D)g;
    ga.setStroke(drawingStroke);
    ga.setPaint(Color.yellow);
    ga.fill(arc);
    ga.draw(arc);
    ga.setPaint(Color.black);
    ga.draw(arc1);

    }

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

Output of this program:

 

Download this program.

                         

» View all related tutorials
Related Tags: c gui com ide browser class stl ui applet io methods classes method sed apple nested override vi component panel

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 
Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

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 | Flex 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.