1 package org.tjworld.components;
5 public class JIconCheckBoxBeanInfo extends SimpleBeanInfo {
9 // Bean descriptor //GEN-FIRST:BeanDescriptor
10 private static BeanDescriptor beanDescriptor = new BeanDescriptor ( JIconCheckBox.class , null );
13 beanDescriptor.setDisplayName ( "JIconCheckBox" );
14 beanDescriptor.setShortDescription ( "A JCheckBox that looks like a JCheckBoxMenuItem" );//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 // Event set information will be obtained from introspection.//GEN-FIRST:Events
28 private static EventSetDescriptor[] eventSets = null;//GEN-HEADEREND:Events
30 // Here you can add code for customizing the event sets array.
34 // Method information will be obtained from introspection.//GEN-FIRST:Methods
35 private static MethodDescriptor[] methods = null;//GEN-HEADEREND:Methods
37 // Here you can add code for customizing the methods array.
41 private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef
42 private static java.awt.Image iconColor32 = null;
43 private static java.awt.Image iconMono16 = null;
44 private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef
45 private static String iconNameC16 = "/org/tjworld/components/media/JIconCheckBoxColor16.gif";//GEN-BEGIN:Icons
46 private static String iconNameC32 = null;
47 private static String iconNameM16 = null;
48 private static String iconNameM32 = null;//GEN-END:Icons
50 private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
51 private static final int defaultEventIndex = -1;//GEN-END:Idx
55 * Gets the bean's <code>BeanDescriptor</code>s.
57 * @return BeanDescriptor describing the editable
58 * properties of this bean. May return null if the
59 * information should be obtained by automatic analysis.
61 public BeanDescriptor getBeanDescriptor() {
62 return beanDescriptor;
66 * Gets the bean's <code>PropertyDescriptor</code>s.
68 * @return An array of PropertyDescriptors describing the editable
69 * properties supported by this bean. May return null if the
70 * information should be obtained by automatic analysis.
72 * If a property is indexed, then its entry in the result array will
73 * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
74 * A client of getPropertyDescriptors can use "instanceof" to check
75 * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
77 public PropertyDescriptor[] getPropertyDescriptors() {
82 * Gets the bean's <code>EventSetDescriptor</code>s.
84 * @return An array of EventSetDescriptors describing the kinds of
85 * events fired by this bean. May return null if the information
86 * should be obtained by automatic analysis.
88 public EventSetDescriptor[] getEventSetDescriptors() {
93 * Gets the bean's <code>MethodDescriptor</code>s.
95 * @return An array of MethodDescriptors describing the methods
96 * implemented by this bean. May return null if the information
97 * should be obtained by automatic analysis.
99 public MethodDescriptor[] getMethodDescriptors() {
104 * A bean may have a "default" property that is the property that will
105 * mostly commonly be initially chosen for update by human's who are
106 * customizing the bean.
107 * @return Index of default property in the PropertyDescriptor array
108 * returned by getPropertyDescriptors.
109 * <P> Returns -1 if there is no default property.
111 public int getDefaultPropertyIndex() {
112 return defaultPropertyIndex;
116 * A bean may have a "default" event that is the event that will
117 * mostly commonly be used by human's when using the bean.
118 * @return Index of default event in the EventSetDescriptor array
119 * returned by getEventSetDescriptors.
120 * <P> Returns -1 if there is no default event.
122 public int getDefaultEventIndex() {
123 return defaultEventIndex;
127 * This method returns an image object that can be used to
128 * represent the bean in toolboxes, toolbars, etc. Icon images
129 * will typically be GIFs, but may in future include other formats.
131 * Beans aren't required to provide icons and may return null from
134 * There are four possible flavors of icons (16x16 color,
135 * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
136 * support a single icon we recommend supporting 16x16 color.
138 * We recommend that icons have a "transparent" background
139 * so they can be rendered onto an existing background.
141 * @param iconKind The kind of icon requested. This should be
142 * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
143 * ICON_MONO_16x16, or ICON_MONO_32x32.
144 * @return An image object representing the requested icon. May
145 * return null if no suitable icon is available.
147 public java.awt.Image getIcon(int iconKind) {
148 switch ( iconKind ) {
149 case ICON_COLOR_16x16:
150 if ( iconNameC16 == null )
153 if( iconColor16 == null )
154 iconColor16 = loadImage( iconNameC16 );
157 case ICON_COLOR_32x32:
158 if ( iconNameC32 == null )
161 if( iconColor32 == null )
162 iconColor32 = loadImage( iconNameC32 );
165 case ICON_MONO_16x16:
166 if ( iconNameM16 == null )
169 if( iconMono16 == null )
170 iconMono16 = loadImage( iconNameM16 );
173 case ICON_MONO_32x32:
174 if ( iconNameM32 == null )
177 if( iconMono32 == null )
178 iconMono32 = loadImage( iconNameM32 );
181 default: return null;