Firstly,I used an option javac -deprecated and compiled.secondly i have run the program using java filename but cannot view any result.
can anybody help in this regard,ur help much appreciated

Recommended Answers

All 7 Replies

I'm assuming your using the command prompt.
If so, why not use an IDE?
Also, if you post your code, might be able to find problem.

I'm assuming your using the command prompt.
If so, why not use an IDE?
Also, if you post your code, might be able to find problem.

Thanks for the reply,here is the code got from internet but i am new to java ,so i dont know how to call the methods in this program through main class

//This applet draws a Bezier curve after user gives the control points
//The Bezier curve is redrawn when user clicks on and moves on of the
//control points
import java.awt.*;
import java.applet.Applet;
public class Bezier extends Applet {
Point[] coordlist; //the control points
int numpoints; //number of control points
Image offscreenImg; //used for double buffering
Graphics offscreenG;
double t; //the time interval
double k = .025; //time step value for drawing curve
int moveflag = 5; //flag to notify if user is moving a point
Button restart;
boolean poly = true; //flag to draw control polygon and points
Button polygon;
public void init() {
//Create coordinate list
coordlist = new Point[4];
numpoints = 0;
//Create offscreen buffer
offscreenImg = createImage(size().width,size().height);
offscreenG = offscreenImg.getGraphics();
//add buttons to screen
restart = new Button("Restart");
polygon = new Button("Polygon");
//this method is called internally by repaint()
public void update(Graphics g) {
public void paint(Graphics g) {
//prepare screen
//Draw control points and polygon
if(poly) {
for(int i=0;i<numpoints;i++) {
if(numpoints>1 && i<(numpoints-1))
//Calculate and draw bezier curve
if(numpoints == 4) {
double x1,x2,y1,y2;
x1 = coordlist[0].x;
y1 = coordlist[0].y;
//use Berstein polynomials
//draw curve
x1 = x2;
y1 = y2;
//check if user presses either button
public boolean action(Event e, Object o) { if ( == restart) {
//start all over with no points
numpoints = 0;
poly = true;
return true;
else if( == polygon) {
poly = false;
poly = true;
return true;
return false;
public boolean mouseDown(Event evt, int x, int y) { //Store point in array
Point point = new Point(x,y);
//if there are less than four points, add another one

if(numpoints < 4) {
coordlist[numpoints] = point;
//otherwise, check if user is trying to click on old point
for(int i=0;i<numpoints;i++)
for(int j=-2;j<3;j++)
for(int l=-2;l<3;l++)
if(point.equals(new Point(coordlist.x+j,
moveflag = i;
return true;
public boolean mouseDrag(Event evt, int x, int y) {
//check if user is trying to drag an old point
if(moveflag < numpoints) {
return true;
public boolean mouseUp(Event evt, int x, int y) {
moveflag = 5;
return true;
public static void main(String arg[])
Bezier be = new Bezier();
can u implement a appropriate main class and make the program show the applet

If so, why not use an IDE?

Not everybody want to use IDE's and why....

Applet have be viewed in web browser or in AppletViewer, plus applet don't have main method

Yes thats right, if you use an IDE such as Netbeans 5.0 /5.5, or most other IDEs, you can view your applet easily.

One thing to point out (True of JApplets anyway) is that an instance of the applet is automatically created at runtime, so you don't need to instantiate the class throught the init() method, or through the main method (like you have done above... Bezier be = new Bezier(); ), besides main method is not necessary, and wouldn't be called initially like in an application.

Doesn't the compiler warning tell you what deprecated method you're trying to use? Or at least a line number? I'm not going to look through that spaghetti code, next time post your code inside code tags.

also, applets do not use a main method like an application would.

I'm assuming your using the command prompt.
If so, why not use an IDE?

IDEs just delay the inevitable. Kids who never use anything but one are utterly lost when they even get a new version of that same IDE that has a few buttons in a different place.
When they have to work without one (which WILL happen) they're completely out of their league.

Do NOT start using an IDE until you can do it manually, and read that documentation (it's there for a reason).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.