Domain Objects Should Not Be Unknown to NetBeans IDE

When you use the "Add to Palette" action in NetBeans IDE, because you want to make your domain objects reusable, the new items look like this in the palette:

Not very nice, because that's the icon for unknown palette items. Somehow you should be able to at least assign icons to the item, as well as, preferably, a display name and tooltip. I looked at the XML file that is generated by the IDE when adding a new item to the palette. That XML file does not contain an attribute for icons, hence the unknown icon is shown. I hardcoded the references to the icons directly into the XML file (using the info found in the NetBeans Code Snippet Module Tutorial), restarted the IDE, and now the items for my domain objects look as follows, which is much better:

I will look in Issuezilla and, if there is no issue for this, I will create one. Either the "unknown icon" should be nicer (simplest solution) or, ideally, the user should be able to select icons for their domain object palette items.

These were the two tags I added, reused from the "Choose Bean" item:

   <icon16 urlvalue="nbres:/org/netbeans/modules/form/resources/palette/choose_bean_16.png" />
   <icon32 urlvalue="nbres:/org/netbeans/modules/form/resources/palette/choose_bean_32.png" />

Comments:

Hi Geertjan, you can have those icon working fine when adding it to the palette.

To solve, create a class named POJOBeanInfo extending SimpleBeanInfo and override getIcon method. Take a look at an example where ReusablePanel extends JPanel (panel, label, textfield, etc.). Then there is a ReusablePanelBeanInfo class.

http://pastebin.com/f1dfe78c4
http://pastebin.com/f704608b7

Posted by Claudio Miranda on February 25, 2008 at 12:33 PM PST #

All this is here:www.pastebin.com

Posted by vehicle on September 26, 2008 at 07:45 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today