We can see how simple it is to create a bean. We have little restrictions on programming. The Java bean design provides a simple input point that can be raised to a more complex level. These high-level issues are beyond the scope of the book, but they will be briefly introduced here. We can find more details on the Http://java.sun.com/beans.
We add more complex programs and its properties to a location. The example above shows a unique attribute, which, of course, can represent an array of properties. This is called an indexed property. We simply provide a corresponding method (plus a naming convention for a method name) and introspector the indexed property, so our Application Builder tool handles it accordingly.
Attributes can be bundled, which means that they will notify other objects via propertychangeevent. Other objects can then modify themselves according to the changes to the bean.
Attributes can be bound, which means that other objects can reject a property when a change cannot be accepted. Other objects use a propertychangeevent to notify, and they produce a proptertyvetoexception to prevent the change from occurring and revert to the original value.
We can also change the way our bean is portrayed at design time:
(1) We can provide a custom property sheet for our special bean. This normal property sheet will be used by all beans, but it will automatically call this property sheet when our bean is selected.
(2) We can create a custom editor for a particular attribute, so the normal property sheet is used, but the editor is invoked automatically when the property we specify is invoked.
(3) We can provide a custom beaninfo class for our bean, and the resulting information is different from the default generated by Introspector.
(4) It is also possible to change the "expert" switch mode in all featuredescriptors to identify basic features and more complex features.