JavaDeploy
SiteMap
Java Certification
Java Beans
Java-OO Concepts
JavaBean Events
«Prev
Intro Javabeans
Javabeans Dev Kit
Installing Bean Kit
Dev Kit Components
Beanbox Test Container
Beanbox Design Time.
Beanbox Runtime
Bean Dev Kit Conclusion
JAR Files
Archive Jar Files
Javabeans Manifest File
Working with jar
Packaging jar Beans
testing-packaged-beans
jar Module Summary
Bean Internals
JavaBeans Structure
Bean Method Encapsulation
Bean Property State
JavaBean Types
Bean Accessor Methods
Getter Setter Methods
Defining Accessor Methods
Bean indexed Properties
indexed Property Accessor
bound Property Notification
Bound Properties Operation
BoundProperty Registration Methods
Javabeans Constrained Properties
Constrained Properties Functionality
Create JavaBean Properties
Using Javabean Properties
Javabean Structure Conclusion
JavaBeans Introspection
Peering Inside Javabean
Introspection Design Patterns
Design Pattern Types
Property Design Patterns
Simple Property Patterns
Indexed Property Patterns
Multicast Event Patterns
Unicast Event Design Patterns
Providing Javabean Information
Building Basic Javabean
Javabean Structure
Event Communication
Wiring JavaBeans together with Events
Objective:
Wire three Beans together using events.
In this exercise you wire three Beans together using events.
Launch the BeanBox
Insert one (1) Juggler Bean
Insert two (2) OurButton Beans
Change the label property of one OurButton Bean to "Start"
Change the label property of the other OurButton Bean to "Stop"
The BeanBox window should now look something like this:
Characteristics of the bean box
BeanBox window
You are now going to wire the first OurButton Bean to the Juggler Bean so that pressing the button starts the animation.
Select the OurButton Bean labeled "Start".
In the BeanBox window, click on the Edit menu item
In the drop-down menu, select Events >> action >> actionperformed
You will see a red line originating from the OurButton Bean. This line is used to graphically connect a listener Bean that will receive
actionPerformed
events.
Click on the Juggler Bean to make it the event listener.
In the EventTargetDialog window, select the
startJuggling()
public method.
The Start button is now successfully wired to the Juggler Bean and can be used to start the animation. To stop the animation:
Select the OurButton Bean labeled "Stop".
In the BeanBox window, click on the Edit menu item
In the drop-down menu, select Events >> action >> actionperformed
Click on the Juggler Bean to make it the event listener.
In the EventTargetDialog window, select the
stopJuggling()
public method.
To test the connected Beans, first disable design time mode, then enable runtime mode.
Click the Submti button to return to the lesson page.