Java Reference
In-Depth Information
CHAPTER 14
JavaBeans
The JavaBeans API provides a framework for defining reusable, embeddable, mod-
ular software components. The JavaBeans specification includes the following defi-
nition of a bean: “a reusable software component that can be manipulated visually
in a builder tool.” As you can see, this is a rather loose definition; beans can take a
variety of forms. At the simplest level, individual GUI components are all beans,
while at a much higher level, an embeddable spreadsheet application might also
function as a bean. Most beans, however, probably fall somewhere between these
two extremes.
One of the goals of the JavaBeans model is interoperability with similar compo-
nent frameworks. So, for example, a native Windows program can, with an appro-
priate bridge or wrapper object, use a Java bean as if it were a COM or ActiveX
component. The details of this sort of interoperability are beyond the scope of this
chapter, however.
Beans can be used at three levels, by three different categories of programmers:
If you are developing GUI editors, application builders, or other “beanbox”
tools, you need the JavaBeans API to manipulate beans within these tools.
beanbox is the name of the sample bean manipulation program provided by
Sun in its JavaBeans Development Kit™ (BDK). * The term is a useful one, and
I'll use it to describe any kind of graphical design tool or application builder
that manipulates beans.
If you are writing actual beans, you need the JavaBeans API to write code that
can be used in any conforming beanbox.
If you are writing applications that use beans developed by other program-
mers or using a beanbox tool to combine those beans into an application, you
don't actually need to be familiar with the JavaBeans API. You only need to
be familiar with the documentation for individual beans that you use.
* You can download the BDK from http://java.sun.com/beans if you do not already have a bean-enabled
development environment.
Search WWH ::




Custom Search