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 on the applet. (The Button can be found in the bean
builder on the left side of the Visual Composition tab in
the figure below.)
- 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 the figure below.)
- 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 the figure below.
- Change the system name of the AS400 bean to TestSys.
- Change the user ID of the AS400 bean to TestUser,
as shown in the figure below.
- Change the command of the CommandCall bean to SNDMSG MSG('Testing')
TOUSR('TESTUSER'), as shown in the figure
below.
- 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
the figure below.
- Select the AS400 bean
- Select this from the pop-up menu that appears
over the AS400 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 the
figure below.
When you are finished, the VisualAge Visual Composition Editor window should
look like the figure below.