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, Part 2
Writing a Simple Bean

by Greg Voss, Javasoft

(November 1996)

[ Creating a Bean | Adding Properties | Download ]

Beans are designed above all to be simple. You need only add a minimal amount of code to an existing class definition to turn a class into a JavaBean.

In the simplest case, you need only add a pair of methods to an existing class definition in order to make a Bean. This can be done either by modifying the source for an existing class, or by extending the behavior of an existing class by subclassing it.

On first impression, there appears to be no difference between a JavaBean and a traditional Java AWT component object. This appearance is intentional. While there are minor differences, such as the fact that Beans need not be visible components, Java you need only follow a few simple rules to make Beans out of existing classes.


Print Button
[ This page was updated: 27-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.