Visual bean builder code example
This example uses the IBM VisualAge for Java Enterprise Edition V2.0 Composition Editor,
but other visual bean builders are similar.
This example creates an applet for a button that, when pressed, runs a command on an AS/400.
- Drag and drop a Button (Button1 in Figure 1) on the applet.
(The Button can be found in the bean builder on the left side of the Visual Composition tab in Figure 1.)
- Drop a CommandCall bean and an AS400 bean outside the applet.
(The beans can be found in the bean builder on the left side of the Visual Composition tab in Figure 1.)
- Edit the bean properties.
(To edit,
select the bean and then right-click to display a pop-up window,
which has Properties as an option.)
- Change the label of the Button to Run command, as shown in
Figure 2.
- Change the system name of the AS400 bean to TestSys.
- Change the user ID of the AS400 bean to TestUser, as shown in Figure 3.
- Change the command of the CommandCall bean to SNDMSG MSG('Testing') TOUSR('TESTUSER'), as shown in Figure 4.
- Connect the AS400 bean to the CommandCall bean.
The method you use to do this varies between bean builders.
For this example,
do the following:
- Select the CommandCall bean and then click the right mouse button
- Select Connect
- Select Connectable Features
- Select system from the list of features as shown in Figure 5.
- Select the AS400 bean
- Select this from the pop-up menu that appears over the AS400 bean
Figure 5.
Connecting AS400 bean to CommandCall bean. |
 |
- Connect the button to the CommandCall bean.
- Select the Button bean and then click the right mouse button
- Select Connect
- Select actionPerformed
- Select the CommandCall bean
- Select Connectable Features from the pop-up menu that appears
- Select run() from the list of methods as shown in Figure 6.
Figure 6.
Connecting a method to a button. |
 |
When you are finished,
the VisualAge Visual Composition Editor window should look like Figure 7.
[ Legal | AS/400 Glossary ]