Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Images in an applet while developing locally

Status
Not open for further replies.

mluken

Programmer
Dec 31, 2003
54
US
I am developing an applet locally using WSAD and am having problems getting my images to load in the applet. Not completely sure how the getImage() method in the Applet class works. Here is what I am doing:

backgroundImage = getImage (getDocumentBase(), "/images/test.jpg");

When I run this in a server, it works fine. However, when running the applet locally, backgroundImage is null, and in that case, getDocumentBase() returns the local path of my working directory.

All of this makes sense to me, but why can't I instead say:

backgroundImage = getImage(new URL("
That still returns null when developing locally but again fine in the server world? Thoughts???

Thanks in adavance!!!
 
Wow that worked great! What about Audio files?

play(getCodeBase(), "/audio/clip.au");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top