1 19 20 package org.netbeans.modules.form.beaninfo.awt; 21 22 import java.awt.Image ; 23 import java.beans.*; 24 import org.openide.util.Utilities; 25 26 31 public class ComponentBeanInfo extends SimpleBeanInfo { 32 33 34 ComponentBeanInfo() { 35 } 36 37 38 public PropertyDescriptor[] getPropertyDescriptors() { 39 try { 40 return new PropertyDescriptor[] { 41 new PropertyDescriptor("background", java.awt.Component .class, "getBackground", "setBackground"), new PropertyDescriptor("foreground", java.awt.Component .class, "getForeground", "setForeground"), new PropertyDescriptor("enabled", java.awt.Component .class, "isEnabled", "setEnabled"), new PropertyDescriptor("name", java.awt.Component .class), new PropertyDescriptor("visible", java.awt.Component .class), new PropertyDescriptor("font", java.awt.Component .class) }; 48 } catch (IntrospectionException ex) { 49 return super.getPropertyDescriptors(); 50 } 51 } 52 53 static class Support extends SimpleBeanInfo { 54 55 String iconName; 56 Class beanClass; 57 58 Support(String icon, Class beanClass) { 59 iconName = icon; 60 this.beanClass = beanClass; 61 } 62 63 public BeanDescriptor getBeanDescriptor() { 64 return new BeanDescriptor(beanClass); 65 } 66 67 70 public Image getIcon(int type) { 71 if (iconName == null) return null; 72 return Utilities.loadImage("org/netbeans/modules/form/beaninfo/awt/" + iconName + ".gif"); } 74 75 public BeanInfo[] getAdditionalBeanInfo() { 76 return new BeanInfo[] { new ComponentBeanInfo() }; 77 } 78 79 80 public PropertyDescriptor[] getPropertyDescriptors() { 81 try { 82 return createPDs(); 83 } catch (IntrospectionException ex) { 84 return null; 85 } 86 } 87 88 protected PropertyDescriptor[] createPDs() throws IntrospectionException { 89 return new PropertyDescriptor[0]; 90 } 91 } 92 } 93 | Popular Tags |