This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
where myClass is the class name in your project and the relative path is the directory in your project you have strored the img
Joined: Aug 18, 2010
Thanks for that, but I'm afraid that didn't work.
What I can't understand is that it is a form created by netbeans and I also have a label with an image which works.
And the code for that is:
Which was generated, but when I copy the code to my section it fails.
Joined: Jul 06, 2010
Don't use getClass(). In the class you are trying to use the code, use the class name e.g of the class you copied (className.class.getResource) that snippet from, and works for that class. Make sure that the directory has the img you want.