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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
How to Create CurveDraw In Java 
 

In this section, you will learn how to create CurveDraw in java.awt package. This class,supported by the java.awt.geom package, enables you to create a quadratic or cubic segment. Here, you will see in the following example that provide you complete code

 

How to Create CurveDraw In Java

                         

Introduction

In this section, you will learn how to create CurveDraw in java.awt package. This class,supported by the java.awt.geom package, enables you to create a quadratic or cubic segment. Here, you will see in the following example that provide you complete code of the program.

Program Description:

Define class named CurveDraw, for creating  this component. 

QuadCurve2D.Double
(): This QuadCurve2D class is defined as a quadratic parametric curve segment in (x, y) coordinate and the quadratic parametric curve segment is specified with Double Coordinate. This class supplies a coordinate space. Such that this class represents the coordinate parameter and is defined for using the CurveDraw component. A QuadCurve  draws the curve line with Double Coordinate.     

Here is the code of this program:

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

public class CurveDraw extends Frame {
  Stroke drawingStroke = new BasicStroke(2);
  QuadCurve2D curve = new QuadCurve2D.Double(30,50,20,200,100,100);

  public void paint(Graphics g) {
    Graphics2D ga = (Graphics2D)g;
    ga.setStroke(drawingStroke);
    ga.setPaint(Color.green);
    ga.draw(curve);

    }

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

Output of this program:

 

Download this program.

                         

» View all related tutorials
Related Tags: c class make method sed boolean value ole set oo frame if boo to ram bool argument e il not

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
Software Solutions
Least Viewed
Most Rated
Recently Viewed
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.