Trouble with a Simple Java Applet's Code for Displaying An Image
[font=comic sans ms,cursive]
Hi guys, I have encountered a problem with my code i am using to try and get a image to display on the screen.[/font]
I am using the Netbeans 7.0.1 IDE and the newest version of JDK.[/font]
This is my Code:[/font]
I think you want to replace getDocumentBase with getCodeBase, as the former returns the location of the document that contains the applet, and I am not entirely sure what this means in the context of your applet. getCodeBase() returns the location of the applet (but this is probably where NetBeans puts the .class file).
That worked perfectly. Thanks mate, I just wondered why the book I took the example from (I'm working on the examples in it, its called Killer Games Programming in Java by O'Reilly) would not work. Also I think the book uses JDK 5, couldnt find anything better, but maybe getDocumentBase() has been replaced with getCodeBase() or they expect me to have made a website to store the images and that on?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement