0

I run an Applet on the Applet Viewer of Eclipse and Netbeans IDEs, the applet contain a text and image, it runs fine, it displays the image and the text correctly.

When I run it on the browsers as Firefox 31 and Firefox 33, and Google Chrome Version 38.0.2125.111 m, it displays the text, and not the image.

I test the absolute and relative path, but the result was the same.

This image displays the details:

http://s23.postimg.org/qm9huz6sr/10_11_2014_14_45_46.jpg

When I display the java console on the browsers, it doesn't show any problem or exception.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Safe Mode
  • 140
  • 1
  • 2
  • 9
  • Where does the applet get the image from? User's file system? – FDIM Nov 09 '14 at 20:22
  • You did not happen to have any code nor configs? – mico Nov 09 '14 at 20:45
  • Yes, a user file system. @mico I don't understand your question. – Safe Mode Nov 09 '14 at 21:49
  • Don't mind. I did wanted to see some code to know what is the issue. Then I found this:http://stackoverflow.com/questions/16847394/java-applet-images-will-not-display-when-run-in-browser Maybe you try using resources from classpath like this guy. – mico Nov 10 '14 at 08:33
  • @mico this is an explain image: http://s23.postimg.org/qm9huz6sr/10_11_2014_14_45_46.jpg – Safe Mode Nov 10 '14 at 13:56
  • Try trailing dash / in the beginning of path, so "/img/" and so on. – mico Nov 10 '14 at 16:11
  • Should image and imageIcon point to same file, also by type? Or do you have icon files separately? I saw other jpg, other png. – mico Nov 10 '14 at 16:35
  • This is not the problem, because the applet runs correctly in Applet Viewer. – Safe Mode Nov 10 '14 at 17:00
  • 1) Never try to load a resource inside the `paint()` method. 2) Why code an applet? If it is due to the teacher specifying it, please refer them to [Why CS teachers should **stop** teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 3) Don't ost screenshots of textual information, post the text itself! 4) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example). – Andrew Thompson Nov 11 '14 at 03:23

0 Answers0