0 Replies Latest reply: Oct 7, 2009 3:09 PM by 843807 RSS

    Netbeans' Customize command not appeared on the context menu

    843807
      I've created a bean called Pump
      public class Pump extends JComponent implements Serializable {
         public Pump() {}
      
         // omit other stuffs...
      }
      I have a customizer class called PumpCustomizer:
      public class PumpCustomizer extends JPanel implements Customizer, ActionListener, PropertyChangeListener {
         protected Pump thePump;
         protected PropertyChangeSupport propSupport;
      
         public PumpCustomizer() {
            setSize(200, 300);
         }
      
         public void setObject(Object bean) {
            thePump = (Pump) bean;
         }
      
         public void propertyChange(PropertyChangeEvent evt) {
         }
      
         public void addPropertyChangeListener(PropertyChangeListener l) {
            propSupport.addPropertyChangeListener(l);
         }
      
          public void removePropertyChangeListener(PropertyChangeListener l) {
              support.removePropertyChangeListener(l);
          }
      
          public void actionPerformed(ActionEvent e) {
          }
      }
      And the PumpBeanInfo class as:
      public class PumpBeanInfo extends SimpleBeanInfo {
        private final static Class beanClass = Pump.class;
        private final static Class customizerClass = PumpCustomizer.class;
      
        private static BeanDescriptor beanDescriptor = null;
      
        public BeanDescriptor getBeanDescriptor() {
          beanDescriptor = new BeanDescriptor(beanClass, customizerClass);
          beanDescriptor.setDisplayName("My Pump");
          return beanDescriptor;
        }
      
        public PropertyDescriptor[] getPropertyDescriptors() {
          try {
            PropertyDescriptor textPD =
              new PropertyDescriptor("text", beanClass);
            PropertyDescriptor rv[] = {textPD};
            return rv;
          } catch (IntrospectionException e) {
            throw new Error(e.toString());
          }
        }
      }
      I was able to add the bean to the Netbeans Palette, and drop it on a Panel at design time. But when I right click on the bean, the context pop up menu does not show the Customize command.

      Any idea what I'm missing here?

      Appreciate your help.

      Edited by: mkeman on Oct 7, 2009 12:51 PM