Tutorial 6


The Instance Manager and JavaBeans

The Instance Manager is a critical part of importing JavaBeans and other components. This tutorial will walk you through a very simple example of how to use it. This Tutorial assumes you have gone through at least one of the previous tutorials.

Step 1. Start with a blank form in the Application Builder. From the Java/awt objects folder, drag a Button object onto Main. The objects in the Java folder are treated like JavaBeans.

Step 2. As soon as you do, JDesignerPro opens the Instance Manager automatically. This is the set of three columns, starting with constructors available for the object imported (Since the components in the Java folder are not native to JDesignerPro, they are treated as imported objects).

Step 3. The constructors displayed are (), string() and "Create from other object". We are going to pass a string value to this button’s constructor to tell it to create a button with a label represented by the string, as below:

Click the (String) constructor.

Step 4. When you click (String) in step 3, The parameter options appear in the second column. Click (String) in the second column. Now the last column will populate with a list of the matching objects or methods for that parameter.

Step 5. To enter a static string label for this button, click the String("String") option at the end of the list. A field will appear under the center column. Enter the text you require for the Button label and press the Accept button.

Step 6. An instance of that button has now been created with the text you chose.

Step 7. Press on the Instance Manager button. It reappears giving us the opportunity to modify our string choice.

Step 8. From the far-right list, open the User tree and select getWWWroot() under Methods. This method will return the value set for the root URL to launch JDesignerPro. By selecting it, it is now found in the center column and has replaced the text entered above. Press Accept.

Step 9. Notice that the button’s label now contains the value for the root directory of JDesignerPro. Normally you might not pass that value to a button label, but this is a good example of how to create an instance and pass the new object a method or parameter from another object.

Step 10. Note that many constructors have several parameters and therefore you would need to define a value for each before pressing Accept.

You will use the Instance Manager in a similar way to define the Constructor and parameters for any JavaBean Object or Component that you import into JDesignerPro. As you become proficient you will find this to a powerful system for using various Java components. There is an additional example in the JDesignerPro\Applications\Examples\InstanceMgr directory that show how instances of outside objects have been created. Load one of them and look at the Instance Manager to get an idea of the steps taken. For instructions on Importing components and objects please see the appropriate section of the Manual.