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

Edited 3 Years Ago by happygeek: fixed formatting

This question has already been answered. Start a new discussion instead.