Example usage for javafx.beans.property DoubleProperty add

List of usage examples for javafx.beans.property DoubleProperty add

Introduction

In this page you can find the example usage for javafx.beans.property DoubleProperty add.

Prototype

@Override
    public DoubleBinding add(final ObservableNumberValue other) 

Source Link

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleProperty a = new SimpleDoubleProperty(0);
    DoubleProperty b = new SimpleDoubleProperty(0);

    DoubleBinding s = a.add(b).divide(2.0D);

    final DoubleBinding aBinding = new When(a.add(b).greaterThan(b).and(a.add(a).greaterThan(b)))
            .then(s.multiply(s.subtract(a)).multiply(s.subtract(b))).otherwise(0.0D);

    a.set(3);//from   ww w.  j a  v a2  s.  c o m
    b.set(4);
    System.out.println(a.get());
    System.out.println(b.get());
    System.out.println(aBinding.get());

    a.set(2);
    b.set(2);
    System.out.println(a.get());
    System.out.println(b.get());
    System.out.println(aBinding.get());

}