1 import javafx.beans.InvalidationListener; 2 import javafx.beans.Observable; 3 import javafx.beans.property.DoubleProperty; 4 import javafx.beans.property.SimpleDoubleProperty; 5 6 public class ObservablePropertyDemo { 7 public static void main(String[] args) { 8 DoubleProperty balance = new SimpleDoubleProperty(); 9 balance.addListener(new InvalidationListener() { 10 public void invalidated(Observable ov) { 11 System.out.println("The new value is " + 12 balance.doubleValue()); 13 } 14 }); 15 16 balance.set(4.5); 17 } 18 }