|
101, Part I Introduction | Page 2 | Page 3 | Page 4 For your first JavaBean, let's look at the BDK BeanBox. Although in this tutorial we use the BeanBox to create a JavaBean, the BeanBox is generally used to test your JavaBeans. The BeanBox is considered a reference builder tool environment. It is not designed for building GUI applications, nor is it meant to have a look and feel of such other builder tools as Visual Age, Delphi, or Visual Basic. You can create a JavaBean and then use the BeanBox to test that it runs properly. If a JavaBean runs properly in the BeanBox, you can be sure that it works properly with other commercial builder tools. Starting the BeanBox When you start the BeanBox, you'll see three windows:
The ToolBox window displays the JavaBeans that are currently installed in the BeanBox, such as the Beans the come with the BeanBox demo. When the BeanBox starts, it automatically loads its ToolBox with the Beans in the JAR files contained in the bean/jars directory. You can add additional Beans, such as your own Beans, to the ToolBox. The next lesson, Writing a Simple JavaBean, explains how to add Beans to the ToolBox. The BeanBox window itself appears initially as an empty window. You use this empty window, sometimes referred to as a "form" by other builder tools, for building applications. The third window, the Properties window, displays the current properties for the selected Bean. If no Bean is selected, such as when you first start the BeanBox or if you click in the BeanBox window's background, then the Properties window displays the BeanBox properties. You can use the Properties window or sheet to edit a Bean's properties. Using the BDK BeanBox Using the Demo BDK JavaBeans The easiest way to understand how the BeanBox works is to use it. The BeanBox enables you to construct simple Beans applications without writing any Java code. As a first example, you can build a simple "Juggling Duke" application in which Duke will start or stop juggling depending on which of two buttons you push. In this lesson, you'll learn how to:
Creating your Bean We'll start by dropping the Juggler Bean from the ToolBox into an empty BeanBox.
Now, when you press the start button Duke should start tossing beans around in a circle over his head like a professional juggler. You can control Duke's juggling speed by manually setting the property value labeled animationRate in the Juggler's property sheet editor. For the appropriate property sheet editor to appear, the Juggler must be the currently selected Bean within the BeanBox frame.
Completing your Program To complete the example program, add a stop button. Repeat the steps you took when you added the start button and connected it to the appropriate Juggler action.
You should now be able to start and stop the juggler by pressing the appropriate button. Summary You've learned how to select Beans from the ToolBox and place them in the BeanBox. Once in the BeanBox, you can use the Bean's Property sheet and property editors to change its appearance. You can also use the BeanBox menu options to connect events from one Bean to another, to initiate and control Bean actions. Keep in mind that the BeanBox is not an application builder tool. Its main purpose is to test Beans and verify that introspection and event hookup works properly. You would not really use the BeanBox to build and run an application. Instead, think of the BeanBox as a reference builder tool. If your bean runs properly in the BeanBox, and it reports the proper events that you want your bean to fire as well as the proper event handlers for events you want it to respond to, you can be confident that your bean will work properly in other Beans-enabled builder tools. Introduction | Page 2 | Page 3 | Page 4 Watch for JavaBeans 101, Part II in November | ||||
|
| ||||||||||||