AS/400 Toolbox for Java API and Technical Reference
This example uses the VisualAge Visual Composition
Editor, but other visual bean builders will generally be similar. This
example creates an applet for a button that when pressed will run a command on
an AS/400.
- Drag and drop a Button (Button1 in Figure 6) on the applet. (The Button can be found in the bean builder on the
left side of the Visual Composition tab in Figure 6.)
- 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 6.)
Figure 6. VisualAge Visual Composition Editor Window - gui.BeanExample.

- Edit the bean properties. (To edit, select the bean and then right
click to display a popup window, which has Properties as an option.)
- Change the label of the Button to Run command as shown in Figure 7.
Figure 7. Changing the Label of the Button to Run Command.

- Change the system name of the AS400 bean to TestSys
- Change the user ID of the AS400 bean to TestUser as shown in Figure 8.
Figure 8. Changing the name of the userID to TestUser.

- Change the command of the CommandCall bean to SNDMSG
MSG('Testing') TOUSR('TESTUSER') as shown in Figure 9.
Figure 9. Changing the Command of the CommandCall Bean.

- 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 system
- Select the AS400 bean
- Select this from the popup menu that appears over the AS400
bean
- Connect the Button to the CommandCall bean.
- Select the CommandCall bean and then click the right mouse button
- Select connect
- Select actionCompleted
- Select the CommandCall bean
- Select All features from the popup menu that appears
- Select run()from the list of methods as shown in Figure 10.
Figure 10. Connecting a Method to a Button.

After you are done, the VisualAge Visual Composition Editor window should
look like Figure 11.
Figure 11. Finished Bean Example