Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 
Training Index

Java Beans Tutorial, Part 4
Customizing Beans for Builder Tools

By Greg Voss, JavaSoft

[Tutorial Contents]

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.

Automatically Resized Beans

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

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

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.

Reflection and Method Descriptors

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.

Print Button
[ This page was updated: 21-Sep-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary | Feedback | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.