The objective of this section is to familiarize you with creating reusable visual parts and using them with VAGen parts. This exercise focuses on the following tasks:
You will build a panel and add labels and fields for address information. Figure 91 shows the panel you will define.
The Create Class SmartGuide is displayed.
Tip: | Choices on the Selected menu are the same as those on the context menu displayed when you select a package and click mouse button 2. |
The new visual part is displayed in the Composition Editor.
In this section of the tutorial, you will add labels and fields for street, city, state, and zipcode.
Complete the following steps to add parts to the Address panel:
Alternatively, you can resize the panel by double-clicking on it to display the Properties window where you can expand the constraints field and set the values in the width and height fields to 400 and 100 respectively.
The Properties window is displayed.
For more detailed information about arranging visual parts see "Arranging visual parts".
If you want to access any information in the Address panel from another visual part, you must add the appropriate features to the bean's public interface. In this case, the features needed are the properties for the text field beans. In this section, you will add properties for all four beans (Street, City, State, and Zip) to the public interface.
For more complete information on topics covered in this section, refer to the VisualAge for Java online help.
To promote bean features to the public interface, perform the following steps:
Note: | Before you promote bean features, you should rename the beans so that you will recognize them when you need to access them from other beans. To rename a bean, select it with mouse button 2 to display the context menu. Select Change Bean Name and type a name in the New bean name field. |
The Promote features from window is displayed.
StreetFieldText is displayed in the Promoted features list.
The text property feature of each of the four beans has been added to the public interface. Now these properties can be accessed by other beans.
Now you are ready to embed the address box in your tutorial view and add VAGen logic parts.