BeanInfo Documentation

Is there any solid documentation for BeanInfo definitions? The SDK document says to refer to the examples, but the examples are pretty sparse on BeanInfo data.

For example, how would I define a boolean property?

Well, one thing to know is that they aren’t our invention. That means you can read some more background info about them elsewhere.

Adding a boolean property would be simple, there are basically two steps for adding any sort of property.

1. Create the getter/setter pair.

To expose a property, you need a getter/setter pair of methods on your component class itself. For a boolean property called [tt]awesomeMode[/tt], the getter/setter should look like this:

[code]public boolean isAwesomeMode() {
return awesomeMode;
}

public void setAwesomeMode(boolean val) {
this.awesomeMode=val;
}[/code]

2. Add the property to the bean info

To add properties in the bean info, override initProperties(). (don’t forget to call super.initProperties).

Then have a line something like this:

addProp("awesomeMode", "Be Awesome?", "If true, the component will be awesome", CAT_BEHAVIOR);