Using Bound Properties Java Help

Using Bound Properties

A Bean that has a bound property generates an event when the property is changed.
The event is of type Property Change Event and is sent to objects that previously , registered an interest in receiving such notifications. The Tick Tock Bean is supplied with the BDK. It generates a property change event every N seconds. N is a property of the Bean that can be changed via the Properties window of the BDK. The next example builds an application that uses the Tick’I’ock Bean to autocratically control the Colors Bean.  how this applicant on,appears.

For this example, start the BDK and create an instance of the’ Colors Bean in the Bean Box window. Create an instance of the Tick Tock BFan. The Properties window should show one property for, this component. It is “Interval” and its initial value is 5. This represents the number of seconds that’elapse between property change events generated by the Tick Tock Bean. Change the value to 1.

Using the Bean info Interface

In our previous examples, design patterns were used to determine the information that was provided to a Bean user. This section describes how a developer can use the  Bean info interface to explicitly control this process.

This interface defines several methods, including these:
Propcrt}rqes.criptor[] getl’ropertyfsescriptorsf )
EventSetDescriptor[] getEventSetDescriptors( )
MethodDescriptor[ ] getMethodDescriptors( )

They return arrays of objects that provide information about the properties, events, and methods of a Bean. By implementing these methods, a developer can designate exactly what is presented to a user.’
Simple Bean info is a class that provides default implementations of the Bean Info .
interface, including the three methods just shown. You may extend this class and override one or more of them. The following listing shows how this is done for the Colors  Bean that was’ developed earlier, Colors Bean info is a subclass of Simple Bean Info. It overrides get Property Description( )in order to designate which properties are presented to a Bean user. This method creates a Property Descriptor object for the  rectangular property. The Descriptiveness or constructor that is used is shown here:

  • Feel free to send us an inquiry, we will reply back in hours.


Posted on September 18, 2014 in Java Beans

Share the Story

About the Author

Back to Top