From: Byron W. <bsl...@mi...> - 2003-04-28 01:10:00
|
put the png in a jar file then do something like URL url = YourClass.class.getResource("your.png"); Image img=Toolkit.getDefaultToolkit().getImage(url); So if your class is called "Game" URL url = Game.class.getResources("your.png"); rememeber that the string you pass to the getResources method is the path in the jar file to the image so getResources("/your.png") would point to the root of the jar file. There is another method that might be helpful: InputStream in = Game.class.getResourceAsStream("your.png"); Then you can do whatever you want with the inputstream. -Byron -----Original Message----- From: gl4...@li... [mailto:gl4...@li...] On Behalf Of kaffiene Sent: Sunday, April 27, 2003 4:41 PM To: gl4...@li... Subject: Re: [gl4java-usergroup] loading pngs from jar files Peter Ashford wrote: > Does anyone know how to load a png from a jar file? An example would > be great. > > Thanks! > > Peter. > Noone has any idea how to do this? ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ gl4java-usergroup mailing list gl4...@li... https://lists.sourceforge.net/lists/listinfo/gl4java-usergroup |