show. If 'this' is a Toolbox instance you could skip that. I'm
assuming a no args constructor for that, but however you really get
a instance.
Toolbox is an abstract class, so most of this won't work.
Running from a terminal, I get: class sun.misc.Launcher
$AppClassLoader@92e78c.
Running from JWS, I get: class
com.sun.jnlp.JNLPClassLoader@1cdeff.
I could try it on another class
(com.bardac.dw1.tools.ui.SplashScreen) which isn't abstract - maybe
tomorrow.
Greg Guerin wrote:
In general, I'd use the following, unless there's a good reason not
to and you're taking a null ClassLoader possibility into account.
rslt = this.getClass().getResource(name);
Using
URL url = SplashScreen.class.getResource("com/bardac/dw1/tools/
graphics/splash.jpg");
(with 1.5.0_16), I get:
[java] Uncaught error fetching image:
[java] java.lang.NullPointerException
[java] at sun.awt.image.URLImageSource.getConnection
(URLImageSource.java:97)
[java] at sun.awt.image.URLImageSource.getDecoder
(URLImageSource.java:106)
[java] at sun.awt.image.InputStreamImageSource.doFetch
(InputStreamImageSource.java:240)
[java] at sun.awt.image.ImageFetcher.fetchloop
(ImageFetcher.java:172)
[java] at sun.awt.image.ImageFetcher.run(ImageFetcher.java:
136)
whereas
URL url = SplashScreen.class.getClassLoader().getResource("com/
bardac/dw1/tools/graphics/splash.jpg");
works fine. Not sure why.
Thanks, Nick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden