Java Reference
In-Depth Information
Step 8: Binding Properties in the Bean Builder
I want you see how bound properties work first-hand, so begin by using the
Customer bean discussed previously. Start by creating a new bean object in the
Bean Builder by clicking File the New on the main menu. If your Movie bean
was previously shown in the JFrame window, it will be deleted and a new
empty window will appear.
I already created a JAR file for you, so all you have to do is load it into the Bean
Builder using the Load Jar File menu item on the File menu. To download this
file, go to the topic's Web site at the URL provided in this topic's Introduction.
After you have loaded the Customer bean, place one in the JFrame window,
as shown in Figure 19.13. I also want you to add a JSlider component (see Fig-
ure 19.13), which is found on the Swing tab of the Bean Builder window.
We will now bind the account number property of the Customer bean to the
value property of the slider. (The value property is an int between 1 and 100
that denotes where the slider appears.) To bind this property, start by clicking
one of the event boxes on the end of the Customer bean in the JFrame. An
arrow appears. Drag the arrow over to one of the event boxes on the slider, as
shown in Figure 19.14.
Figure 19.13
Add a Customer bean and a JSlider component to the design window.
Search WWH ::




Custom Search