Java Reference
In-Depth Information
System.out.println("Calling d.set(10000000000L).");
d.set(10000000000L);
System.out.println("d.get() = " + d.get());
System.out.println("f.get() = " + f.get());
System.out.println("l.get() = " + l.get());
System.out.println("i.get() = " + i.get());
}
}
In this example we created four numeric properties and bound them into a chain in decreasing size to
demonstrate that the bindings work as expected. We then reversed the order of the chain and set the double
property's value to a number that would overflow the integer property to highlight the fact that even though you can
bind different sizes of numeric properties together, when the value of the dependent property is outside the range of
the binding property, normal Java numeric conversion applies.
When we run the program in Listing 4-4, the following is printed to the console:
Constructed numerical properties i, l, f, d.
i.get() = 1024
l.get() = 0
f.get() = 0.0
d.get() = 0.0
Bound l to i, f to l, d to f.
i.get() = 1024
l.get() = 1024
f.get() = 1024.0
d.get() = 1024.0
Calling i.set(2048).
i.get() = 2048
l.get() = 2048
f.get() = 2048.0
d.get() = 2048.0
Unbound l to i, f to l, d to f.
Bound f to d, l to f, i to l.
Calling d.set(10000000000L).
d.get() = 1.0E10
f.get() = 1.0E10
l.get() = 10000000000
i.get() = 1410065408
Commonly Used Classes
We now give a survey of the content of the four packages javafx.beans , javafx.beans.binding , javafx.beans.
property , and javafx.beans.value . In this section, “the SimpleIntegerProperty series of classes” refers to the
classes extrapolated over the Boolean , Integer , Long , Float , Double , String , and Object types. Therefore what is said
also applies to SimpleBooleanProperty , and so on.
The most often used classes in the JavaFX properties and bindings framework are the
SimpleIntegerProperty series of classes. They provide all the functionalities of the Property
interface including lazy evaluation. They are used in all the examples of this chapter up to this
point.
 
Search WWH ::




Custom Search