Constrained Properties Java Help

Constrained Properties

A Bean that has a constrained property generates an event when an attempt is made to change its value. The event is of type Property Change Event. It is sent to objects that, previously registered an interest in receiving such notifications. Those other objects have the ability to veto the proposed change. This capability allows a Bean to operate differently according to its run-time environment. A full discussion of constrained properties is beyond the scope of this book.


Persistence is the ability to save a Bean to nonvolatile storage and retrieve it at a later .time. The information that is particularly important are the’ configuration settings. Let us first see how the BDK allows you to save a set of Beans that have been configured and connected together to form an application. Recall our previous example ‘involving both the Colors and Tick Tock Beans. The rectangular property of the Colors Bean was changed to true, and the interval property of the Tick Tock Bean was changed to one second. : To save the application, go to the menu bar of the Bean Box and select File I Save . .A dialog box should appear, allowing you to specify the name of a file to which the Beans and their configuration parameters should be saved. Supply ,a file name and c lick the OK button on that dialog box. Exit from the BDK. Start the BDK again. To restore the application, go to the menu bar of the Bean Box and select File I Load. A dialog box should appear, allowing you to specify the name of the file from which an application should be restored. Supply the name of the file in which the application was saved, and click the OK button. Your application should ‘now be functioning. Confirm that the rectangular property of the Colors Bean is true and that the interval property for the Tick Tock Bean is equal to one second.

 Of The object serialization capabilities provided by the Java class libraries arc used
to provide persistence for Beans. If a Bean inherits directly or indirectly from . [ava.awt.Component, it is automatically serialize, because that class implements
the [ interface. If a Bean does not inherit an implementation of the Serialize interface, you must provide this yourself. Otherwise, containers cannot save the configuration of your component.  The transient keyword can be used to designate data members of a Bean that should not be serialized. The color variable of the Colors class is example of such an Item .


The Properties window of the BDK allows a developer to modify the properties of a
Bean, However, this may not be the best user interface for a complex component with many Interrelated properties. There  a Bean developer can provide Excursionist that.

helps another developer configure this software, A customizer can provide a step-by-step guide through the process that must be followed to use the component in a specific context. Online documentation can also be provided. A Bean developer has great flexibility to develop a customizer that can differentiate his or her product in the marketplace.

Beans Are the Future

Java Beans technology is at the cutting edge of Java programming, and the creation of component software will be an important part of most Java programmers’ jobs in the near future. Beans also form a complement to ActiveX, Microsoft’s software component architecture. Programs such as Internet Explorer, Microsoft Office, and Visual Basic can serve as containers for these components. The Java Beans Bridge for ActiveX is a tool that can be downloaded from This tool makes it possible to use Java Beans in ActiveX containers. The Java Beans Migration Assistant for ActiveX  is an other tool that can be downloaded from This program analyzes an ActiveX control and generates a skeleton Java Bean.

  • 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