You need to create and compile a BeanInfo class for your bean. The icon is supplied by the Icon property of BeanInfo.

To do this simply and quickly, expand the respective class node in the Projects View, right-click on the Bean Patters node and select BeanInfo Editor in the menu and edit the properties as needed.

Source: NetBeans User FAQ