Example usage for javafx.beans.binding Bindings multiply

List of usage examples for javafx.beans.binding Bindings multiply

Introduction

In this page you can find the example usage for javafx.beans.binding Bindings multiply.

Prototype

public static NumberBinding multiply(int op1, final ObservableNumberValue op2) 

Source Link

Document

Creates a new javafx.beans.binding.NumberBinding that calculates the product of the value of a javafx.beans.value.ObservableNumberValue and a constant value.

Usage

From source file:Main.java

public static void main(String[] args) {
    IntegerProperty x1 = new SimpleIntegerProperty(0);
    IntegerProperty y1 = new SimpleIntegerProperty(0);

    final NumberBinding x1y2 = Bindings.multiply(x1, y1);

    final NumberBinding sum1 = Bindings.add(x1y2, 2);
    final NumberBinding diff1 = Bindings.subtract(sum1, 1);
    final NumberBinding determinant = Bindings.subtract(diff1, 2);
    final NumberBinding area = Bindings.divide(determinant, 2.0D);

    x1.set(0);//ww w .  ja  v  a 2  s . c  o  m
    y1.set(0);

    printResult(x1, y1, area);

    x1.set(1);
    y1.set(0);

    printResult(x1, y1, area);
}