Example usage for javafx.beans.binding NumberBinding getValue

List of usage examples for javafx.beans.binding NumberBinding getValue

Introduction

In this page you can find the example usage for javafx.beans.binding NumberBinding getValue.

Prototype

T getValue();

Source Link

Document

Returns the current value of this ObservableValue

Usage

From source file:Main.java

public static void main(String[] args) {
    IntegerProperty num1 = new SimpleIntegerProperty(1);
    IntegerProperty num2 = new SimpleIntegerProperty(2);
    NumberBinding sum = num1.add(num2);
    System.out.println(sum.getValue());
    num1.set(2);//from w w w .j  a v  a 2 s  .co  m
    System.out.println(sum.getValue());
}

From source file:Main.java

public static void main(String[] args) {
    // Area = width * height
    IntegerProperty width = new SimpleIntegerProperty(10);
    IntegerProperty height = new SimpleIntegerProperty(10);
    NumberBinding area = width.multiply(height);
    System.out.println(area.getValue());
}

From source file:Main.java

public static void main(String[] args) {

    final IntegerProperty width = new SimpleIntegerProperty(10);
    final IntegerProperty height = new SimpleIntegerProperty(10);

    NumberBinding area = width.multiply(height);

    System.out.println(width.get() + " " + height.get());
    System.out.println(area.getValue());

    width.set(100);// ww  w .j av  a2s. co  m
    height.set(200);

    System.out.println(width.get() + " " + height.get());
    System.out.println(area.getValue());
}

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/*from   w ww. j  av  a  2s .c  o  m*/
        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());
}

From source file:Main.java

private static void printResult(IntegerProperty x1, IntegerProperty y1, NumberBinding area) {
    System.out.println(x1.get());
    System.out.println(y1.get());
    System.out.println(area.getValue());
}