Problem loading images
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Peter_Eeles
Posted On:   Sunday, November 25, 2007 06:20 AM

I've written the simplest of Java applets that loads a single image (a map) for a conservation website. However, I've determined that, depending on the filename (it appears), the map is either visible or not. I was after some help to debug this - I really don't understand why the filename "Peacock.gif" works but "Glanville Fritillary.gif" doesn't. Other filenames with spaces in the name are fine, so I don't think this is a factor. The map itself is fine since I can simply change the name and it works fine! Possibly some kind of caching problem? Code below. HTML Applet code import java.applet.Applet; impor   More>>

I've written the simplest of Java applets that loads a single image (a map) for a conservation website. However, I've determined that, depending on the filename (it appears), the map is either visible or not. I was after some help to debug this - I really don't understand why the filename "Peacock.gif" works but "Glanville Fritillary.gif" doesn't. Other filenames with spaces in the name are fine, so I don't think this is a factor. The map itself is fine since I can simply change the name and it works fine! Possibly some kind of caching problem? Code below.


HTML


			










Applet code


			
import java.applet.Applet;
import java.awt.*;

public class bsiteAppletDistribution2 extends Applet
{
private static final long serialVersionUID = 1L;

Image map;

public void init()
{
map = this.getImage(this.getDocumentBase(), "Peacock.gif");
}

public void destroy()
{
map.flush();
}

public void update(Graphics g)
{
paint(g);
}

public void paint(Graphics g)
{
g.drawImage(map, 0, 0, this);
}
}
   <<Less

Re: Problem loading images

Posted By:   Peter_Eeles  
Posted On:   Monday, November 26, 2007 09:26 AM

Hmmm. I've rolled back to version 1.5 of the JRE and everything works fine. Seems like it's a bug in the caching implementation of version 1.6 but can't be sure.

Any ideas? And thanks in advance!

- Pete
About | Sitemap | Contact