PNG Icons: generic paths for Linux and Win

Hi,

I have this piece of code, that is very specific to my computer, and i;d like to make it as generica as possible so it can run both on a LinuxBox and a windows machine.

I plan to put the icons in a folder called [images] and would like to have the icons taken from there.

thank you!

-uday

protectedstatic ImageIcon createImageIcon(boolean connected){

if (connected){

returnnew ImageIcon("C:/uday/HIS_Phase1/Workspaces/Workspace/HIS/images/start.png","Running");

}else{

returnnew ImageIcon("C:/uday/HIS_Phase1/Workspaces/Workspace/HIS/images/no_start.png","Running");

}

}

[1209 byte] By [uday_prakasha] at [2007-11-27 2:19:16]
# 1
You can use a relative path to the class that is currently executing.Eg. "images/start.png"
maple_shafta at 2007-7-12 2:19:29 > top of Java-index,Desktop,Core GUI APIs...
# 2
Add a zip file with all your png file in classpath.And you can refer to one picutre in code like this:getClass().getResource("/image.png");
J@A@V@Aa at 2007-7-12 2:19:29 > top of Java-index,Desktop,Core GUI APIs...
# 3
Thank You!!!the zip file is a good idea...-Uday
uday_prakasha at 2007-7-12 2:19:29 > top of Java-index,Desktop,Core GUI APIs...