Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JButton's icon property in the inspector only shows <none>

dsieversFeb 9 2008 — edited Feb 11 2008
First let me say that I'm a newbie to using JDeveloper and I'm using version 10.1.3.3.0.

I have a file called add.png in a resource directory which has the same structure as my java files. I want to assign this image to my JButton. In the GUI designer, why doesn't the Inspector's icon property show my file as a choice? It only shows <none>. I even tried moving the file into the same directory as my java files and it still doesn't show up. In Netbeans there is a browse button for the icon property so I can choose the file and location, but I don't see a way of doing that in JDeveloper. The only way I can get the icon for my button to work is to code the line myself, like so:
btnIcon.setIcon(new ImageIcon(getClass().getResource("add2.png")));

Am I missing something?

Thanks in advance,
Dan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2008
Added on Feb 9 2008
3 comments
602 views