List of usage examples for javafx.beans.binding NumberBinding addListener
void addListener(ChangeListener<? super T> listener);
From source file:MyClass.java
public static void main(String[] args) { MyClass myObject1 = new MyClass(); MyClass myObject2 = new MyClass(); MyClass myObject3 = new MyClass(); NumberBinding total = Bindings.add(myObject1.amountDueProperty().add(myObject2.amountDueProperty()), myObject3.amountDueProperty()); total.addListener(new InvalidationListener() { @Override/* www .ja v a 2s. c om*/ public void invalidated(Observable o) { System.out.println("The binding is now invalid."); } }); myObject1.setAmountDue(200.00); myObject2.setAmountDue(100.00); myObject3.setAmountDue(75.00); System.out.println(total.getValue()); myObject3.setAmountDue(150.00); System.out.println(total.getValue()); }