The BeanInfo
class lets the BeanBox and other application construction
tools uncover information you specify about the Bean. This is what
makes it possible to hookup Bean components through a visual
programming paradigm. You have control over how your Bean is
presented to programmers inside these application builders. You can
make Beans automatically adjust their size to accomodate changes in
their content.
You can add a special BeanInfo
class let you
change the name used to display the Bean, and control the visibility
of properties and methods to builder tools. Control of visibility of
properties can help give a Bean a clean presentation to users. You
may also want to provide special editors or configuration wizzards to
allow users to customize your Beans. You'll learn how to add a
PropertyEditor
to a Bean and how to use method
descriptors and property descriptors to control custom presentation.
In this section, you'll learn how to set the preferred and
minimium sizes for a Bean displayed in a builder tool. You
can also make Beans automatically adjust their size to
accomodate changes in their content.
Adding a BeanInfo
class for NervousText lets
you specify a custom presentation for the Bean. You can
change the name displayed by builder tools as well as
specify icons to be used to show the Bean in a builder
tool's palette. A BeanInfo object also lets you
specify property descriptors that determine what
properties will be publicly visible. This is handy
for presenting a cleaner list of customizable properties
for programmers to manipulate.
Adding a PropertyEditor
to your Bean lets
you have complete control over how properties are modified by end
users. You can provide anything from simple choice lists to complex
configuration wizards that are programs in their own right. This
section shows you how to add a PropertyEditor
to
NervousText
.
This section shows how to use
reflection to create Method objects for building MethodDescriptors
used by Beans. A list of such descriptors can be associated with a
Bean through a BeanInfo
class to present a reduced
interface that is less cluttered and easier to read. Specifying a
list of method descriptors is similar to specifying a list of property
descriptors to reduce the number of visible properties.