Bean Tester
Setting up Event Handling
The Bean Tester lets you connect an event generated by a bean
(the source bean) to an event handling method in another
bean (the target bean). For example, you can assemble a
component with a button that can be pressed to cause another bean
to do something.
The Bean Tester provides two ways to wire events: Layout mode
and Visual Connect mode.
To set up event handling in Layout mode:
- Select the bean that will be the source of the event.
- Choose the Connect Events... item from the Connect menu.
This brings up the Connect Events dialog:

- Select the event set (for example, mouse or key) and type
(for example, mouse pressed or mouse released) that you
want to trigger an action.
- Select the target bean from the Target drop-down list.
This lists the other beans currently in the working area
that can handle events.
- Select the method in the Target bean that will handle the
event and click the Apply button.
To set up event handling in Visual Connect mode:
- Click on the Visual Connect mode icon or Mode-->Visual
Connect menu item. This mode provides a nonvisible
representation of all the beans that you have assembled
in layout mode. You cannot add any new objects to the
canvas while in this mode.
- Click on the object that will be the source the event.
The Tester draws circles and rectangles on the selected
object. If you click and drag from the circle
on the selected object to another selected object, it
brings up the Connect Events dialog shown above.
- Select the event set (for example, mouse or key) and type
(for example, mouse pressed or mouse released) that you
want to trigger an action.
- The Target bean is the bean you connected the Source bean
to. Select the method in the Target bean that you want to
handle the event and click the Apply button.
- Once the connection is made, the Tester displays a wire
showing you the event name and the handling method. The
source and sink in objects are joined by an arrow
indicating this is a event handling connection.
Note: In Visual Connect mode, you can move any of the objects
without affecting the underlying layout.
Once the connection is made, the Tester displays a wire
showing you the beans you connected. The source event and target
method are joined by an arrow (-->)
indicating that this is an event connection. For example, in this
figure, an actionPerformed (button pressed) even on the
ExplicitButton cause the startJuggling method to be called on the
Juggler bean:

The Tester generates an adapter class to
implement the event handling. After the adapter is generated, you
can save the composite bean as a new
bean that includes the event handling functionality.
Copyright ©
Taligent, Inc. 1996 - 1997.
Copyright © IBM Corporation 1996 - 1997.
All Rights Reserved.