01: import java.beans.*;
02:
03: /**
04: The bean info for the car bean, specifying the properties
05: and their editors.
06: */
07: public class CarBeanBeanInfo extends SimpleBeanInfo
08: {
09: public PropertyDescriptor[] getPropertyDescriptors()
10: {
11: try
12: {
13: PropertyDescriptor colorProperty
14: = new PropertyDescriptor("color",
15: CarBean.class);
16: colorProperty.setPropertyEditorClass(
17: CustomColorEditor.class);
18:
19: PropertyDescriptor dimensionProperty
20: = new PropertyDescriptor("dimension",
21: CarBean.class);
22: dimensionProperty.setPropertyEditorClass(
23: DimensionEditor.class);
24:
25: PropertyDescriptor drawModeProperty
26: = new PropertyDescriptor("drawMode",
27: CarBean.class);
28: drawModeProperty.setPropertyEditorClass(
29: DrawModeEditor.class);
30:
31: return new PropertyDescriptor[]
32: {
33: colorProperty,
34: dimensionProperty,
35: drawModeProperty
36: };
37: }
38: catch (IntrospectionException exception)
39: {
40: return null;
41: }
42: }
43: }