I’m using Netbeans 6.7.1 on Windows Vista, I’ve got a JavaBean component that works as it should and this has an associated BeanInfo class where I’ve set Icon 32×32 Color property to a 32×32 gif file located on the classpath. I’ve also set the 16×16 Color property similarly.
I’ve added the bean to the palette but the icon displayed is the default ? icon.
Is there anything else I’m supposed to set?
Thanks
[updates]
I’ve put some system output for the ide log in the getIcon() method of the BeanInfo class and this is correctly returning the appropriate icon when I’m viewing the palette.
I’ve tried netbeans 6.8 and the problem remains.
…
I’ve now created a new project, in a folder off c: and I’ve used the netbeans 6.8 wizards to create a JavaBean and a BeanInfo class to go with it, then set the 32×32 icon using the BeanInfo editor. I’ve made different gif files in ms paint and adobe illustrator.
So I’ve not actually written any code myself, all I’ve done is use dialogs to generate code and point at a gif file.
I think I might have also lost the will to live, but that might be down the back of the sofa.
Advertisement
Answer
OK, so it turns out this is a known bug (see the netbeans buglist: 177343), the fix might be available in Netbeans 6.9.
The solution is to edit your BeanInfo class in a text editor (netbeans won’t let you edit this part of the generated file, if you generated it with the wizard) then edit the filename string for your icon and put a / in front of it, recompile, bingo!
[edit] Actually, you can sometimes just put your own / infront of the filename after choosing it using the editor, I can’t quite work out the steps to do it reliably, you might have better luck.