BeanInfo Editor Dialog Box

The BeanInfo Editor dialog box enables you to edit the elements of a BeanInfo class. To display this dialog box, right-click the Bean Patterns node of the class whose BeanInfo you want to create or update. Choose BeanInfo Editor from the contextual menu.

The Properties node in the left panel contains bean properties that conform to the JavaBeans specification. The properties in the right panel reflect characteristics and settings of objects in the IDE. Thus, in the BeanInfo Editor dialog box, you can set properties of the bean properties themselves.

For all the nodes below BeanInfo, the color of the node icon indicates whether the properties for that node are taken from when the bean is used. If the node is gray, properties are taken from introspection. If the node is in color, introspection is not used, so code for properties in the BeanInfo Editor is generated in the BeanInfo class when you click the OK button.

Bean Info Node

When the Bean Info node is selected, the first four properties in the property sheet panel enable you to designate icons for the bean by entering the classpath for the graphic file you want to use. Click the ellipsis (...) button to display a dialog box that lets you search for the desired classpath and displays the icon when the classpath has been found.

The next two properties, Default Property Index and Default Event Index, are the indexes of the default property and event in the PropertyDescriptor and EventSetDescriptor arrays, respectively. Set the value to -1 if there is no default property or event.

For information about these JavaBeans elements, see "BeanInfo" in the API documentation that comes with your Java 2 SDK, or see Sun's web site at http://java.sun.com/products/jdk/1.3/docs/api/java/beans/BeanInfo.html.

Bean Node

This node represents the BeanDescriptor. If Get From Introspection is set to true, bean descriptor information is taken from introspection when the bean is used.

If Get From Introspection is false, you can customize the BeanDescriptor's properties by clicking the subnode of Bean. The properties Display Name Code and Short Description Code are used as parameters to the methods setDisplayName and setShortDescription, and should therefore be null, a quoted string, or code that evaluates to the desired string. Similarly, the Expert property Customizer Name Code is passed as a parameter to the BeanDescriptor initializer.

If you click the ellipsis (...) button to edit a code property, a Java property editor is displayed, in which you can use Java Source Editor features (such as syntax highlighting and Java code completion).

Properties, Event Sources, and Methods Nodes

Like the Bean node, these nodes have only one property in the property sheet, Get From Introspection. If Get From Introspection is set to true, all information about the bean's properties, events, or methods is taken from introspection when the bean is used, and the generated BeanInfo returns a null value instead of an array of descriptors of properties, event sets, or methods.

If Get From Introspection is false and you right-click any of these nodes, you can choose to include or exclude all of the properties, event sources, or methods from the BeanInfo.

Subnodes of Properties, Event Sources, and Methods

The subnodes represent the bean properties, events, and methods themselves. If the subnodes are gray, these elements are taken from introspection when the bean is used. Therefore, setting the properties of gray subnodes has no effect in the generated BeanInfo code. The information below assumes that Get From Introspection is set to false in the properties, events, or methods.

The most important property for each subnode is Include in BeanInfo, which is set to true by default. If you set this property to false, the JavaBeans property, event, or method is not shown to users or other classes.

When Include in BeanInfo is true, appears next to the subnode. When Include in BeanInfo is false, appears.

Other node icons in the BeanInfo Editor have the same meaning that they have in the Explorer or Object Browser, as described in Node Icons in the Explorer and the Object Browser.

As described for the Bean node, the properties Display Name Code and Short Description Code are used as parameters to setter methods and should therefore be null, a quoted string, or code that evaluates to the desired string. If you click the ellipsis (...) button to edit these properties, a Java property editor is displayed in which you can use Java Source Editor features such as syntax highlighting and code completion.

Two properties of each bean property subnode--Expert and Preferred--are used to determine how the bean property is displayed in an IDE. If you reuse the bean in this IDE, these property settings determine how the bean properties are displayed in the Component Inspector as follows:

If you want to set a property in the right panel to the same value for multiple JavaBeans properties, events, or methods, use the Shift key to select several consecutive nodes or the Control key to select individual nodes and then set the properties for all of them at once.
See also
Generating BeanInfo
Creating a Bean
Component Inspector

Legal Notices