This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 177343 - The Netbeans 6.7.1 does not set the icon in BeanInfo Editor.
Summary: The Netbeans 6.7.1 does not set the icon in BeanInfo Editor.
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Beans (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-20 19:49 UTC by wel2007
Modified: 2010-01-25 08:32 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The projects that show the problem. (113.50 KB, application/octet-stream)
2009-11-20 19:51 UTC, wel2007
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wel2007 2009-11-20 19:49:45 UTC
I have realized that the Netbeans 6.7.1 does not set the icon to a bean component when I use the BeanInfo Editor. I created a simple bean extended of a JLabel just to show up the problem. Please, follow the next steps:

1. I opened the Netbeans IDE 6.7.1 and created a new project named "IconBeanInfoTest".
2. In the "Source Packages" node I created three new packages: "file", "gui" and "lib".
3. Into the package "file" I put a gif picture file named "Sum16x16.gif".
4. Into the package "lib" I created a new class named "MyJLabel" that extends the "JLabel" class. This new class has one constructor method that just set the text of the "JLable" using the "setText(Strint text)" method.
6. Into the "gui" package I created a new "JFrame" form that was named "JFrame1".
7. Then I right clicked over the "MyJLabel" class and chose the option "BeanInfo Editor..." Then I accepted pressing "yes" on the message "BeanInfo does not exist. Do you wish to create a new BeanInfo?" After that the "MyJLabelBeanInfo" appeared on my project.
8. So I clicked on the design bottom and scrolled to the root of the tree on the BeanInfo Editor. On the properties I set the "Icon 16x16 color" property using the form and choosing the gif image that I've had put into the "file" package.
9. After that I saved the project and pressed (SHIFT+F11) to clean and build.
10. Then I drag and drop "MyLabel" bean to a form "JFrame1", but the icon of the gif image did not appear on the Inspector panel.

Note:
1. When I follow the previous steps from 1 to 10 using Netbeans 6.5.1 the problem does not exist.
2. If I do the project using Netbeans 6.5.1 and open the same project using Netbeans 6.7.1 the problem does not exist. But if I try to change some icon using BeanInfo Editor the problem appear (I cant see my new icon on the inspector panel). After I've changed unsuccessfully the icon using Netbean 6.7.1, if I close the project and open it on the Netbeans 6.5.1 the problem will be there and property "icon 16x16 color" will be saying that happened a exception "java.lang.NullPoiterException".

I have attached a zip file including the project the two projects one made using Netbeans 6.5.1 and another one including the project made by Netbeans 6.7.1.

Thank you.
welbsonsiquiera@yahoo.com.br
Comment 1 wel2007 2009-11-20 19:51:09 UTC
Created attachment 91459 [details]
The projects that show the problem.
Comment 2 Jan Pokorsky 2009-11-24 09:02:16 UTC
NB 6.7.* does set the icon in BeanInfo Editor. The difference is in the icon path. It seems to miss to add initial slash in the path. Thus the icon cannot be found.

In order to work around it open MyJLabelBeanInfo.java in plain editor and change line 764 from

    private static String iconNameC16 = "file/Sum16x16.gif";//GEN-BEGIN:Icons

to

    private static String iconNameC16 = "/file/Sum16x16.gif";//GEN-BEGIN:Icons
Comment 3 Jan Pokorsky 2009-11-25 10:13:54 UTC
Fixed as jet-main#db84a45fe47d and jet-main#141f5d77359c. The 2nd change set allows to reset the defined icon to null value when designer changes propagate to source code.
Comment 4 Quality Engineering 2009-11-26 19:31:18 UTC
Integrated into 'main-golden', will be available in build *200911261400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/db84a45fe47d
User: Jan Pokorsky <jpokorsky@netbeans.org>
Log: #177343: fixed icon path to comply with Class.getResource
Comment 5 Peter Pis 2010-01-13 05:46:34 UTC
Verified.

Product Version: NetBeans IDE Dev (Build 201001120200)
Comment 6 pgebauer 2010-01-14 04:35:58 UTC
The fix has been ported into the release68_fixes repository.
http://hg.netbeans.org/release68_fixes/rev/0a1d1db5ed5a
Comment 7 Peter Pis 2010-01-25 08:32:29 UTC
V.