Applet Image Missing
Hello again Stackoverflow members, The CatchTheCreature Applet class is supposed to display an image being repainted in different locations by a time delay, but for some reason the
Solution 1:
..image = new ImageIcon("Monster.png");
- The
String
based constructor toImageIcon
presumes theString
to represent aFile
. - A sand-boxed applet cannot access
File
objects, but can accessURL
s coming from the same code base/document base. - Use
getDocumentBase()
/getCodeBase()
with an relative path to the image, and the applet will be portable (assuming the image is also uploaded to the same place).
Post a Comment for "Applet Image Missing"