1 package org.tjworld.components;
5 public class JIconRadioButtonBeanInfo extends SimpleBeanInfo {
8 // Bean descriptor //GEN-FIRST:BeanDescriptor
9 private static BeanDescriptor beanDescriptor = new BeanDescriptor ( JIconRadioButton.class , null );
12 beanDescriptor.setDisplayName ( "JIconRadioButton" );
13 beanDescriptor.setShortDescription ( "Radio Button with a User Functionalty Icon" );//GEN-HEADEREND:BeanDescriptor
15 // Here you can add code for customizing the BeanDescriptor.
17 }//GEN-LAST:BeanDescriptor
19 // Properties information will be obtained from introspection.//GEN-FIRST:Properties
20 private static PropertyDescriptor[] properties = null;//GEN-HEADEREND:Properties
22 // Here you can add code for customizing the properties array.
26 // Event set information will be obtained from introspection.//GEN-FIRST:Events
27 private static EventSetDescriptor[] eventSets = null;//GEN-HEADEREND:Events
29 // Here you can add code for customizing the event sets array.
33 // Method information will be obtained from introspection.//GEN-FIRST:Methods
34 private static MethodDescriptor[] methods = null;//GEN-HEADEREND:Methods
36 // Here you can add code for customizing the methods array.
40 private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef
41 private static java.awt.Image iconColor32 = null;
42 private static java.awt.Image iconMono16 = null;
43 private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef
44 private static String iconNameC16 = "/org/tjworld/components/media/JIconRadioButtonColor16.gif";//GEN-BEGIN:Icons
45 private static String iconNameC32 = null;
46 private static String iconNameM16 = null;
47 private static String iconNameM32 = null;//GEN-END:Icons
49 private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
50 private static final int defaultEventIndex = -1;//GEN-END:Idx
54 * Gets the bean's <code>BeanDescriptor</code>s.
56 * @return BeanDescriptor describing the editable
57 * properties of this bean. May return null if the
58 * information should be obtained by automatic analysis.
60 public BeanDescriptor getBeanDescriptor() {
61 return beanDescriptor;
65 * Gets the bean's <code>PropertyDescriptor</code>s.
67 * @return An array of PropertyDescriptors describing the editable
68 * properties supported by this bean. May return null if the
69 * information should be obtained by automatic analysis.
71 * If a property is indexed, then its entry in the result array will
72 * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
73 * A client of getPropertyDescriptors can use "instanceof" to check
74 * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
76 public PropertyDescriptor[] getPropertyDescriptors() {
81 * Gets the bean's <code>EventSetDescriptor</code>s.
83 * @return An array of EventSetDescriptors describing the kinds of
84 * events fired by this bean. May return null if the information
85 * should be obtained by automatic analysis.
87 public EventSetDescriptor[] getEventSetDescriptors() {
92 * Gets the bean's <code>MethodDescriptor</code>s.
94 * @return An array of MethodDescriptors describing the methods
95 * implemented by this bean. May return null if the information
96 * should be obtained by automatic analysis.
98 public MethodDescriptor[] getMethodDescriptors() {
103 * A bean may have a "default" property that is the property that will
104 * mostly commonly be initially chosen for update by human's who are
105 * customizing the bean.
106 * @return Index of default property in the PropertyDescriptor array
107 * returned by getPropertyDescriptors.
108 * <P> Returns -1 if there is no default property.
110 public int getDefaultPropertyIndex() {
111 return defaultPropertyIndex;
115 * A bean may have a "default" event that is the event that will
116 * mostly commonly be used by human's when using the bean.
117 * @return Index of default event in the EventSetDescriptor array
118 * returned by getEventSetDescriptors.
119 * <P> Returns -1 if there is no default event.
121 public int getDefaultEventIndex() {
122 return defaultEventIndex;
126 * This method returns an image object that can be used to
127 * represent the bean in toolboxes, toolbars, etc. Icon images
128 * will typically be GIFs, but may in future include other formats.
130 * Beans aren't required to provide icons and may return null from
133 * There are four possible flavors of icons (16x16 color,
134 * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
135 * support a single icon we recommend supporting 16x16 color.
137 * We recommend that icons have a "transparent" background
138 * so they can be rendered onto an existing background.
140 * @param iconKind The kind of icon requested. This should be
141 * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
142 * ICON_MONO_16x16, or ICON_MONO_32x32.
143 * @return An image object representing the requested icon. May
144 * return null if no suitable icon is available.
146 public java.awt.Image getIcon(int iconKind) {
147 switch ( iconKind ) {
148 case ICON_COLOR_16x16:
149 if ( iconNameC16 == null )
152 if( iconColor16 == null )
153 iconColor16 = loadImage( iconNameC16 );
156 case ICON_COLOR_32x32:
157 if ( iconNameC32 == null )
160 if( iconColor32 == null )
161 iconColor32 = loadImage( iconNameC32 );
164 case ICON_MONO_16x16:
165 if ( iconNameM16 == null )
168 if( iconMono16 == null )
169 iconMono16 = loadImage( iconNameM16 );
172 case ICON_MONO_32x32:
173 if ( iconNameM32 == null )
176 if( iconMono32 == null )
177 iconMono32 = loadImage( iconNameM32 );
180 default: return null;