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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you specify a relative searchpath when dealing with images?

Status
Not open for further replies.

zappsweden

Programmer
Aug 29, 2001
16
SE
I am currently using some images and the only way it works is if i specify the path by something like "c:\\blabla\\myimage.gif"

here is how i use it for getting an image(btw is getImage any better than createImage? I just can't se any difference)

track = Toolkit.getDefaultToolkit().createImage("c:\\testtrack.gif");

How can i specify a filename in the same directory?
How can i specify a filename in a directory "up one level"

I have already tried for the same dir
".\\myimage.gif" or "myimage.gif"

and for up one level
"..\\myimage.gif"

and they don't work. PLEASE help!

 
BTW, I am using swing components, NOT applet(in case it makes a difference).
 
What I meant with "same directory" was "current directory"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top