This is an essential feature of the java beans API because it allows another application, such as a design tool, to obtain information about a component. There are two ways in which the developer of a bean can indicate which of its properties, events, and methods should be exposed. With the first method, simple naming conventions to infer the introspection mechanisms to infer information about a bean. In the second way, an additional class that extends the Beaninfo interface is provided that explicitly supplies this information. The values assigned to the properties determine the behavior and appearance of that component.
|Published (Last):||6 December 2011|
|PDF File Size:||10.78 Mb|
|ePub File Size:||1.34 Mb|
|Price:||Free* [*Free Regsitration Required]|
Type the following: javac Colors. Create a Manifest File You must now create a manifest file. This is the directory in which the manifest files for the BDK demos are located. Put the source code for your manifest file in the file colors. Notice that the Colors. These files are generated with the jar utility. Enter the following: jar cfm.. You may wish to put this in a batch file for future use. This causes the BDK to start.
Test your new component by pressing the mouse anywhere within its borders. Its color immediately changes. Use the Properties window to change the rectangular property from false to true. Its shape immediately changes. You should see that the button appearance changes immediately when this property is changed. Move the cursor so that it is inside the Colors Bean display area, and click the left mouse button. You should see the Event Target Dialog dialog box. The dialog box allows you to choose a method that should be invoked when this button is clicked.
You should see the color change. You might want to experiment with the Colors Bean a bit before moving on. Posted by.
Java BeanUtils - Customizing Introspection