Geertjan's Blog

  • February 22, 2008

Domain Objects Should Not Be Unknown to NetBeans IDE

Geertjan Wielenga
Product Manager
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" />

Join the discussion

Comments ( 2 )
  • Claudio Miranda Monday, February 25, 2008

    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.



  • vehicle Friday, September 26, 2008

    All this is here:www.pastebin.com

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.