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.

  1. 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.)

  2. 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.
    Figure rzahh000 not displayed.


  3. Edit the bean properties. (To edit, select the bean and then right click to display a popup window, which has Properties as an option.)

    1. 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.
      Figure rzahh004 not displayed.


    2. Change the system name of the AS400 bean to TestSys

    3. 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.
      Figure rzahh003 not displayed.


    4. 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.
      Figure rzahh005 not displayed.


  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:

    1. Select the CommandCall bean and then click the right mouse button

    2. Select connect

    3. Select system

    4. Select the AS400 bean

    5. Select this from the popup menu that appears over the AS400 bean

  5. Connect the Button to the CommandCall bean.

    1. Select the CommandCall bean and then click the right mouse button

    2. Select connect

    3. Select actionCompleted

    4. Select the CommandCall bean

    5. Select All features from the popup menu that appears

    6. Select run()from the list of methods as shown in Figure 10.

    Figure 10. Connecting a Method to a Button.
    Figure rzahh001 not displayed.


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

Figure 11. Finished Bean Example


Figure rzahh002 not displayed.