1 package org.tjworld.components;
5 public class ColourQubeBeanInfo extends SimpleBeanInfo {
9 // Bean descriptor //GEN-FIRST:BeanDescriptor
10 private static BeanDescriptor beanDescriptor = new BeanDescriptor ( ColourQube.class , null );
13 beanDescriptor.setDisplayName ( "ColourQube" );
14 beanDescriptor.setShortDescription ( "Colour Chooser" );//GEN-HEADEREND:BeanDescriptor
16 // Here you can add code for customizing the BeanDescriptor.
18 }//GEN-LAST:BeanDescriptor
20 // Properties information will be obtained from introspection.//GEN-FIRST:Properties
21 private static PropertyDescriptor[] properties = null;//GEN-HEADEREND:Properties
23 // Here you can add code for customizing the properties array.
27 // EventSet identifiers//GEN-FIRST:Events
30 private static EventSetDescriptor[] eventSets = new EventSetDescriptor[0];
31 //GEN-HEADEREND:Events
33 // Here you can add code for customizing the event sets array.
37 // Method information will be obtained from introspection.//GEN-FIRST:Methods
38 private static MethodDescriptor[] methods = null;//GEN-HEADEREND:Methods
40 // Here you can add code for customizing the methods array.
44 private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef
45 private static java.awt.Image iconColor32 = null;
46 private static java.awt.Image iconMono16 = null;
47 private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef
48 private static String iconNameC16 = "/org/tjworld/vista/cid/media/qube.gif";//GEN-BEGIN:Icons
49 private static String iconNameC32 = null;
50 private static String iconNameM16 = null;
51 private static String iconNameM32 = null;//GEN-END:Icons
53 private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
54 private static final int defaultEventIndex = -1;//GEN-END:Idx
58 * Gets the bean's <code>BeanDescriptor</code>s.
60 * @return BeanDescriptor describing the editable
61 * properties of this bean. May return null if the
62 * information should be obtained by automatic analysis.
64 public BeanDescriptor getBeanDescriptor() {
65 return beanDescriptor;
69 * Gets the bean's <code>PropertyDescriptor</code>s.
71 * @return An array of PropertyDescriptors describing the editable
72 * properties supported by this bean. May return null if the
73 * information should be obtained by automatic analysis.
75 * If a property is indexed, then its entry in the result array will
76 * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
77 * A client of getPropertyDescriptors can use "instanceof" to check
78 * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
80 public PropertyDescriptor[] getPropertyDescriptors() {
85 * Gets the bean's <code>EventSetDescriptor</code>s.
87 * @return An array of EventSetDescriptors describing the kinds of
88 * events fired by this bean. May return null if the information
89 * should be obtained by automatic analysis.
91 public EventSetDescriptor[] getEventSetDescriptors() {
96 * Gets the bean's <code>MethodDescriptor</code>s.
98 * @return An array of MethodDescriptors describing the methods
99 * implemented by this bean. May return null if the information
100 * should be obtained by automatic analysis.
102 public MethodDescriptor[] getMethodDescriptors() {
107 * A bean may have a "default" property that is the property that will
108 * mostly commonly be initially chosen for update by human's who are
109 * customizing the bean.
110 * @return Index of default property in the PropertyDescriptor array
111 * returned by getPropertyDescriptors.
112 * <P> Returns -1 if there is no default property.
114 public int getDefaultPropertyIndex() {
115 return defaultPropertyIndex;
119 * A bean may have a "default" event that is the event that will
120 * mostly commonly be used by human's when using the bean.
121 * @return Index of default event in the EventSetDescriptor array
122 * returned by getEventSetDescriptors.
123 * <P> Returns -1 if there is no default event.
125 public int getDefaultEventIndex() {
126 return defaultEventIndex;
130 * This method returns an image object that can be used to
131 * represent the bean in toolboxes, toolbars, etc. Icon images
132 * will typically be GIFs, but may in future include other formats.
134 * Beans aren't required to provide icons and may return null from
137 * There are four possible flavors of icons (16x16 color,
138 * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
139 * support a single icon we recommend supporting 16x16 color.
141 * We recommend that icons have a "transparent" background
142 * so they can be rendered onto an existing background.
144 * @param iconKind The kind of icon requested. This should be
145 * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
146 * ICON_MONO_16x16, or ICON_MONO_32x32.
147 * @return An image object representing the requested icon. May
148 * return null if no suitable icon is available.
150 public java.awt.Image getIcon(int iconKind) {
151 switch ( iconKind ) {
152 case ICON_COLOR_16x16:
153 if ( iconNameC16 == null )
156 if( iconColor16 == null )
157 iconColor16 = loadImage( iconNameC16 );
160 case ICON_COLOR_32x32:
161 if ( iconNameC32 == null )
164 if( iconColor32 == null )
165 iconColor32 = loadImage( iconNameC32 );
168 case ICON_MONO_16x16:
169 if ( iconNameM16 == null )
172 if( iconMono16 == null )
173 iconMono16 = loadImage( iconNameM16 );
176 case ICON_MONO_32x32:
177 if ( iconNameM32 == null )
180 if( iconMono32 == null )
181 iconMono32 = loadImage( iconNameM32 );
184 default: return null;