1 19 20 package examples.colorpicker; 21 22 import java.beans.*; 23 24 public class ColorPreviewBeanInfo extends SimpleBeanInfo { 25 26 private static final int PROPERTY_blue = 0; 28 private static final int PROPERTY_green = 1; 29 private static final int PROPERTY_red = 2; 30 31 private static PropertyDescriptor[] properties = new PropertyDescriptor[3]; 33 34 static { 35 try { 36 37 properties[PROPERTY_blue] = new PropertyDescriptor ( "blue", ColorPreview.class, "getBlue", "setBlue" ); 38 properties[PROPERTY_green] = new PropertyDescriptor ( "green", ColorPreview.class, "getGreen", "setGreen" ); 39 properties[PROPERTY_red] = new PropertyDescriptor ( "red", ColorPreview.class, "getRed", "setRed" ); 40 } 41 catch( IntrospectionException e) {} 43 45 } 47 49 private static final int EVENT_propertyChangeListener = 0; 50 52 private static EventSetDescriptor[] eventSets = new EventSetDescriptor[1]; 53 54 static { 55 try { 56 57 eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( ColorPreview.class, "propertyChangeListener", java.beans.PropertyChangeListener .class, new String [] { "propertyChange" }, "addPropertyChangeListener", "removePropertyChangeListener" ); 58 } 59 catch( IntrospectionException e) {} 61 63 } 65 66 private static String ICON_COLOR_16x16 = null; private static String ICON_COLOR_32x32 = null; 68 private static String ICON_MONO_16x16 = null; 69 private static String ICON_MONO_32x32 = null; 71 72 public PropertyDescriptor[] getPropertyDescriptors() { 73 return properties; 74 } 75 76 public EventSetDescriptor[] getEventSetDescriptors() { 77 return eventSets; 78 } 79 80 81 java.awt.Image icon = loadImage ("/tutorial/colorpicker/ColorPreview.gif"); 82 83 public java.awt.Image getIcon (int iconKind) { 84 85 switch (iconKind) { 86 case java.beans.BeanInfo.ICON_COLOR_16x16: return icon; 87 } 88 return null; 89 90 } 91 } 92
| Popular Tags
|