1 package org.tjworld.components;
\r
5 public class JIconToggleButtonBeanInfo extends SimpleBeanInfo {
\r
13 // Bean descriptor //GEN-FIRST:BeanDescriptor
\r
14 private static BeanDescriptor beanDescriptor = new BeanDescriptor ( JIconToggleButton.class , null );
\r
17 beanDescriptor.setDisplayName ( "JIconToggleButton" );
\r
18 beanDescriptor.setShortDescription ( "A JToggleButton with a Functionality Icon" );//GEN-HEADEREND:BeanDescriptor
\r
20 // Here you can add code for customizing the BeanDescriptor.
\r
22 }//GEN-LAST:BeanDescriptor
\r
24 // Properties information will be obtained from introspection.//GEN-FIRST:Properties
\r
25 private static PropertyDescriptor[] properties = null;//GEN-HEADEREND:Properties
\r
27 // Here you can add code for customizing the properties array.
\r
29 //GEN-LAST:Properties
\r
31 // Event set information will be obtained from introspection.//GEN-FIRST:Events
\r
32 private static EventSetDescriptor[] eventSets = null;//GEN-HEADEREND:Events
\r
34 // Here you can add code for customizing the event sets array.
\r
38 // Method information will be obtained from introspection.//GEN-FIRST:Methods
\r
39 private static MethodDescriptor[] methods = null;//GEN-HEADEREND:Methods
\r
41 // Here you can add code for customizing the methods array.
\r
45 private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef
\r
46 private static java.awt.Image iconColor32 = null;
\r
47 private static java.awt.Image iconMono16 = null;
\r
48 private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef
\r
49 private static String iconNameC16 = "/org/tjworld/components/media/JIconToggleButtonColor16.gif";//GEN-BEGIN:Icons
\r
50 private static String iconNameC32 = null;
\r
51 private static String iconNameM16 = null;
\r
52 private static String iconNameM32 = null;//GEN-END:Icons
\r
54 private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
\r
55 private static final int defaultEventIndex = -1;//GEN-END:Idx
\r
59 * Gets the bean's <code>BeanDescriptor</code>s.
\r
61 * @return BeanDescriptor describing the editable
\r
62 * properties of this bean. May return null if the
\r
63 * information should be obtained by automatic analysis.
\r
65 public BeanDescriptor getBeanDescriptor() {
\r
66 return beanDescriptor;
\r
70 * Gets the bean's <code>PropertyDescriptor</code>s.
\r
72 * @return An array of PropertyDescriptors describing the editable
\r
73 * properties supported by this bean. May return null if the
\r
74 * information should be obtained by automatic analysis.
\r
76 * If a property is indexed, then its entry in the result array will
\r
77 * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
\r
78 * A client of getPropertyDescriptors can use "instanceof" to check
\r
79 * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
\r
81 public PropertyDescriptor[] getPropertyDescriptors() {
\r
86 * Gets the bean's <code>EventSetDescriptor</code>s.
\r
88 * @return An array of EventSetDescriptors describing the kinds of
\r
89 * events fired by this bean. May return null if the information
\r
90 * should be obtained by automatic analysis.
\r
92 public EventSetDescriptor[] getEventSetDescriptors() {
\r
97 * Gets the bean's <code>MethodDescriptor</code>s.
\r
99 * @return An array of MethodDescriptors describing the methods
\r
100 * implemented by this bean. May return null if the information
\r
101 * should be obtained by automatic analysis.
\r
103 public MethodDescriptor[] getMethodDescriptors() {
\r
108 * A bean may have a "default" property that is the property that will
\r
109 * mostly commonly be initially chosen for update by human's who are
\r
110 * customizing the bean.
\r
111 * @return Index of default property in the PropertyDescriptor array
\r
112 * returned by getPropertyDescriptors.
\r
113 * <P> Returns -1 if there is no default property.
\r
115 public int getDefaultPropertyIndex() {
\r
116 return defaultPropertyIndex;
\r
120 * A bean may have a "default" event that is the event that will
\r
121 * mostly commonly be used by human's when using the bean.
\r
122 * @return Index of default event in the EventSetDescriptor array
\r
123 * returned by getEventSetDescriptors.
\r
124 * <P> Returns -1 if there is no default event.
\r
126 public int getDefaultEventIndex() {
\r
127 return defaultEventIndex;
\r
131 * This method returns an image object that can be used to
\r
132 * represent the bean in toolboxes, toolbars, etc. Icon images
\r
133 * will typically be GIFs, but may in future include other formats.
\r
135 * Beans aren't required to provide icons and may return null from
\r
138 * There are four possible flavors of icons (16x16 color,
\r
139 * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
\r
140 * support a single icon we recommend supporting 16x16 color.
\r
142 * We recommend that icons have a "transparent" background
\r
143 * so they can be rendered onto an existing background.
\r
145 * @param iconKind The kind of icon requested. This should be
\r
146 * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
\r
147 * ICON_MONO_16x16, or ICON_MONO_32x32.
\r
148 * @return An image object representing the requested icon. May
\r
149 * return null if no suitable icon is available.
\r
151 public java.awt.Image getIcon(int iconKind) {
\r
152 switch ( iconKind ) {
\r
153 case ICON_COLOR_16x16:
\r
154 if ( iconNameC16 == null )
\r
157 if( iconColor16 == null )
\r
158 iconColor16 = loadImage( iconNameC16 );
\r
159 return iconColor16;
\r
161 case ICON_COLOR_32x32:
\r
162 if ( iconNameC32 == null )
\r
165 if( iconColor32 == null )
\r
166 iconColor32 = loadImage( iconNameC32 );
\r
167 return iconColor32;
\r
169 case ICON_MONO_16x16:
\r
170 if ( iconNameM16 == null )
\r
173 if( iconMono16 == null )
\r
174 iconMono16 = loadImage( iconNameM16 );
\r
177 case ICON_MONO_32x32:
\r
178 if ( iconNameM32 == null )
\r
181 if( iconMono32 == null )
\r
182 iconMono32 = loadImage( iconNameM32 );
\r
185 default: return null;
\r