[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Loading Images in plug-in

Hi all,

I'm writing a plug-in, and when I use the setImage function on a Shell object, with a relative path like

objShell.setImage(objDisplay,"icons/pic1.gif");


I get a java.io.FileNotFoundException (due to the relative path). It works properly for absolute paths.
How do I write a function in my plug-in that "accepts just the relative path of the image and returns an Image object to it". The function should be like...


	import org.eclipse.swt.graphics.Image;
	...
	public static Image getImageFunction(Display display, String filename){

		/*****************************
		 * return Image, on no error;
		 *         null, otherwise
		 *****************************
		*/
	}

Thanks in advance,
Siv

P.S. For what is is worth!
1. All source files are inside a single package inside the 'src' directory
2. The icon files are not. They are in an 'icons' directory, at the same level as the 'src' directory.