Java Reference
In-Depth Information
25.3. java.beans Components
The JavaBeans component architecture helps independent vendors
write classes that can be treated as components of larger systems as-
sembled by users. The java.beans package provides necessary and use-
ful classes for writing such beans. A bean exports properties, generates
events, and implements methods. By following certain design patterns or
by implementing methods that provide a description of these facets of
behavior, you can compose beans by using interactive tools to build a
system the user needs.
Much of a bean's behavior is simplified if you follow expected design pat-
terns. For example, if your bean class is called Ernest and you provide
a class named ErnestBeanInfo that implements the BeanInfo interface, the
JavaBeans tools will use ErnestBeanInfo as a source of information about
the behavior of the bean: the events it supports, the icons it uses, and
so on.
Providing a BeanInfo object is itself optionalthe JavaBeans system will use
reflection to infer events and properties. For example, if a class Ernest
has methods named getImportance and setImportance , the JavaBeans sys-
tem will assume that you have an importance property that can be set,
either directly or via another bean. Builder tools are expected to present
the properties and events to users, who can use them to connect beans
as components to build custom applications.
AWT components are beans, and the event model described earlier for AWT
components is also the JavaBeans event model.
The JavaBeans component architecture is designed to interoperate with
existing component architectures, extending the "Write Once, Run Any-
where" capability to create a homogeneous component platform.
The subpackage java.beans.beancontext defines interfaces and classes
that are used to talk about the context in which a bean or set of beans is
executing. Bean contexts can be nested.
 
Search WWH ::




Custom Search