Creating aggregate JavaFX bindings

The standard JavaFX API provides a class named Bindings that can be used to create all kinds of bindings your application may need. Methods in this class can be used to translate any Observable, ObservableValue, Binding, Expression, and/or Property into another Binding, regardless of their original type. Here’s for example how you could translate a StringProperty into an IntegerBinding, by exposing the length of the contained String: StringBinding sourceBinding = … // initialized elsewhere IntegerBinding lengthBinding = Bindings.createIntegerBinding( () -> sourceBinding.get().length(), sourceBinding); While quick and to the point we’re forced to read the value directly from the inputs (in this Read More

ˆ Back To Top