KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > colorpicker > ColorPreviewBeanInfo


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package examples.colorpicker;
21
22 import java.beans.*;
23
24 public class ColorPreviewBeanInfo extends SimpleBeanInfo {
25
26     // Property identifiers //GEN-FIRST:Properties
27
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     // Property array
32
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) {}//GEN-HEADEREND:Properties
42

43         // Here you can add code for customizing the properties array.
44

45     }//GEN-LAST:Properties
46

47     // EventSet identifiers //GEN-FIRST:Events
48

49     private static final int EVENT_propertyChangeListener = 0;
50     // EventSet array
51

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 JavaDoc.class, new String JavaDoc[] { "propertyChange" }, "addPropertyChangeListener", "removePropertyChangeListener" );
58         }
59         catch( IntrospectionException e) {}//GEN-HEADEREND:Events
60

61         // Here you can add code for customizing the event sets array.
62

63     }//GEN-LAST:Events
64

65
66     private static String JavaDoc ICON_COLOR_16x16 = null; //GEN-BEGIN:Icons
67
private static String JavaDoc ICON_COLOR_32x32 = null;
68     private static String JavaDoc ICON_MONO_16x16 = null;
69     private static String JavaDoc ICON_MONO_32x32 = null; //GEN-END:Icons
70

71
72     public PropertyDescriptor[] getPropertyDescriptors() {
73         return properties;
74     }
75
76     public EventSetDescriptor[] getEventSetDescriptors() {
77         return eventSets;
78     }
79
80
81     java.awt.Image JavaDoc icon = loadImage ("/tutorial/colorpicker/ColorPreview.gif");
82
83     public java.awt.Image JavaDoc 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