Skip to content Skip to sidebar Skip to footer

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 to ImageIcon presumes the String to represent a File.
  • A sand-boxed applet cannot access File objects, but can access URLs 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"