hi guys,

i am working on applets, below is a bit of coding i am working on, it compiles with out any problem, but when i run it i get an error msg saying:

"Exception thread "main" java.lang.NoSuchMethodError: main"

if any one can advice it will be appreciated a lot...

the code isn't really a big program, it is jst working from 1 image at this stage and i want to expand it later...

// Draw.java


import java.awt.Image;
import java.awt.Graphics;


public class Draw extends java.applet.Applet {


public void paint(Graphics g)
{
int imageWidth    = tImage.getWidth(this);
int imageHeight   = tImage.getHeight(this);
int numberOfDukes = appletWidth / imageWidth;
int firstColumn   =
(appletWidth - (imageWidth * numberOfDukes))/2;
int currentColumn = firstColumn;


// draw a line of Dukes in default size


for (int n = 0; n < numberOfDukes; n++) {
g.drawImage(tImage, currentColumn, 20, this);
currentColumn += imageWidth;
}


g.drawLine( firstColumn,
20 + imageHeight + 10,
appletWidth - firstColumn,
20 + imageHeight + 10);


// change aspect ratio, double in size, centre
g.drawImage(tImage,
(appletWidth-(imageHeight * 2)) /2,
20 + imageHeight + 20,
imageHeight * 2, imageWidth * 2,  this);
}


public void init()
{
tImage = getImage(getCodeBase(), "DUKE.GIF");


// v1.0 size is deprecated; 1.1 use getSize
appletWidth = this.getSize().width;
}


private Image tImage;
private int   appletWidth ;
private int   leftColumn  = 10;
}

thanks for your time..
tc..

Recommended Answers

All 3 Replies

also how can i make my browser support java..

thx dude...i'll check that now..
tc

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.