List of usage examples for javafx.beans.binding DoubleBinding DoubleBinding
DoubleBinding
From source file:Main.java
public static void main(String[] args) { final DoubleProperty radius = new SimpleDoubleProperty(2); DoubleBinding volumeOfSphere = new DoubleBinding() { {// w w w .j a v a 2 s . c o m super.bind(radius); } @Override protected double computeValue() { return radius.get() + 4; } }; System.out.println(radius.get()); System.out.println(volumeOfSphere.get()); radius.set(50); System.out.println(radius.get()); System.out.println(volumeOfSphere.get()); }
From source file:Main.java
public static void main(String[] args) { final DoubleProperty x = new SimpleDoubleProperty(null, "x", 2.0); final DoubleProperty y = new SimpleDoubleProperty(null, "y", 3.0); DoubleBinding area = new DoubleBinding() { {/*from w w w . ja v a 2s. c o m*/ super.bind(x, y); } @Override protected double computeValue() { System.out.println("computeValue() is called."); return x.get() * y.get(); } }; System.out.println("area.get() = " + area.get()); x.set(5); y.set(7); System.out.println("area.get() = " + area.get()); }
From source file:Main.java
public static void main(String[] args) { final DoubleProperty x = new SimpleDoubleProperty(null, "x", 2.0); final DoubleProperty y = new SimpleDoubleProperty(null, "y", 3.0); DoubleBinding area = new DoubleBinding() { private double value; {/*from w w w .j a va 2s . com*/ super.bind(x, y); } @Override protected double computeValue() { System.out.println("computeValue() is called."); return x.get() * y.get(); } }; System.out.println("area.get() = " + area.get()); x.set(5); y.set(7); System.out.println("area.get() = " + area.get()); }
From source file:Main.java
public static void main(String[] args) { final DoubleProperty a = new SimpleDoubleProperty(0); final DoubleProperty b = new SimpleDoubleProperty(0); final DoubleProperty c = new SimpleDoubleProperty(0); DoubleBinding area = new DoubleBinding() { {/*from w w w .j a va2s .co m*/ super.bind(a, b, c); } @Override protected double computeValue() { double a0 = a.get(); double b0 = b.get(); double c0 = c.get(); return a0 * b0 * c0; } }; a.set(2); b.set(2); c.set(2); System.out.println(area.get()); }