I'm trying to load an image in an Applet.The code goes fine and the Applet Window starts but it just gives a blank window instead of showing the image.I put the html file,.class file and the image file in the same directory.Can u figure out where I went wrong??
Here's my complete code :---
import java.applet.Applet;
import java.awt.*;
public class ImageTest extends Applet
{
private Image img;
public void init()
{
img = null;
}
public void loadImage()
{
try
{
img = getImage(getCodeBase(), "image1.gif");
}
catch(Exception e) { }
}
public void paint(Graphics g)
{
if (img == null)
loadImage();
g.drawImage(img, 0, 0, this);
}
}
here's the html code:---
<applet width=300 height=300 code="ImageTest.class"> </applet>
Please figure out the problem.Thanx in advance....