import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
// This
applet displays a single image twice,
// once at its normal size and once much wider.
public class ImageDisplayer extends JApplet {
static
String imageFile = "D:/vijay_dreams/JavaExamples/pegeon.gif";
public void init() {
Image image = getImage(getCodeBase(), imageFile);
ImagePanel imagePanel = new ImagePanel(image);
getContentPane().add(imagePanel, BorderLayout.CENTER);
}
}
class ImagePanel extends JPanel {
Image image;
public ImagePanel(Image image) {
this.image = image;
}
public void paintComponent(Graphics g) {
super.paintComponent(g); // Paint background
// Draw image at its natural size first.
g.drawImage(image, 0, 0, this); //85x62 image
// Now draw the image scaled.
g.drawImage(image, 90, 0, 300, 62, this);
}
}
**************************************
The above pgm gives me and runtime error as,
/* Exception in
thread "main" java.lang.NoSuchMethodError: main */
can anyone explain why?
Thanks and Regards,
viji.