I am looking for some help with Eclipse. I can not get my images to show in my applet viewer. If I embed the applet in an html file, they display just fine. My file names are accurate (I've checked a gazillion times), and the paths are correct. I am trying something more complicated than this, but even this code does not display. Text shows up also. Is there settings somewhere I need to adjust?? Please help. I'm going nuts!
I've never tried to run an applet from Eclipse, so I can't help you with that.
I would like to point out that it's not wise to load your image in the paint method. That method may be called several times a second, and you really don't want to load the same image over and over again. It's better to do that in the init() method:
Now the image is only loaded once, when the applet is initialized.
David Herron wrote:..The book our class has us using actually does this...
I've said before that any book that rushes into teaching applets is suspect. But this one is far worse, in that the authors have demonstrated they are clueless - we should never be loading images in the paint method. Use that book for something useful like a door stop or paper weight, and get a goodJava text to replace it.
posted 9 years ago
At least I am only renting it! I am on the last assignment for this class, and I'm giving it the boot ASAP! I recently attained a new Java book for my library and it seems much better. And BTW.. I solved my initial problem, which was I had been putting my images into the src file when I needed to be placing them into the bin folder (where the class file is located).