Example usage for javafx.beans.property LongProperty bind

List of usage examples for javafx.beans.property LongProperty bind

Introduction

In this page you can find the example usage for javafx.beans.property LongProperty bind.

Prototype

void bind(ObservableValue<? extends T> observable);

Source Link

Document

Create a unidirection binding for this Property .

Usage

From source file:Main.java

public static void main(String[] args) {
    IntegerProperty i = new SimpleIntegerProperty(null, "i", 1024);
    LongProperty l = new SimpleLongProperty(null, "l", 0L);

    System.out.println("i.get() = " + i.get());
    System.out.println("l.get() = " + l.get());

    l.bind(i);

    i.set(2048);/*  ww  w  . j a va  2  s .c  o  m*/

    System.out.println("i.get() = " + i.get());
    System.out.println("l.get() = " + l.get());

    l.unbind();
    System.out.println("Unbound l to i, f to l, d to f.");

    i.bind(l);
    System.out.println("Bound f to d, l to f, i to l.");

    System.out.println("Calling d.set(10000000000L).");
    i.set(100);

    System.out.println("l.get() = " + l.get());
    System.out.println("i.get() = " + i.get());
}