|
Another problem now, using images by classpath.
I use the Toolkit.getImage() and it will work fine if I use a full path (e.g ""C:\Documents\Thez\test.jpg") but if I try to use a classpath it gives an 'Uncaught error fetching image: NullPointerException'.
My project has two packages, 'core' and 'images'.
I tried with a simple JLabel from NetBeans and it uses 'getClass().getResource("/images/test.jpg")' and the label shows the image just fine.
If I try Toolkit.getImage(getClass().getResource("/images/test.jpg")); it gives the error.
Any idea what I'm doing wrong?
|