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
Converting Existing Code to Beans

By Greg Voss, JavaSoft

[Tutorial Contents]

Got some old code you'd like to update? Have a look at how it's done with the NervousText example program that's been distributed with the JDKTM.

All AWT components in JDK 1.1 are Beans. This means they are already set up to be used as reusable components in builder tools. However, older JDK 1.0 programs and some JDK 1.1 demo programs are not built as Beans. This lesson describes how to convert existing programs and applets into Beans.

You'll start by taking the NervousText sample applet and turning it into a Bean. You can look at this file in the JDK 1.1 distribution tree under the directory demo/NervousText.

There are several advantages to learning about Beans by converting existing programs. First, you'll be able to concentrate on the parts of the program or applet that are unique to Beans. Second, by working on a familar example program that is somewhat typical of other programs you may need to convert, you will see the Beans features you need to learn first.

The concepts introduced in this lesson include:

  • Reflection
  • Event Handling
  • Bean Customization

Start by taking a look at the existing JDK 1.1 code for the NervousText.java. As you may already know, this applet displays jittering text on the screen, giving the impression that the text has had a little too much coffee this morning. The JDK 1.1 version of NervousText will be the starting point of reference from which subsequent changes in this lesson will be made.

The next section, Making NervousText into a Bean, contains the steps to make the conversion.


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.