Example usage for javafx.beans.property IntegerProperty unbind

List of usage examples for javafx.beans.property IntegerProperty unbind

Introduction

In this page you can find the example usage for javafx.beans.property IntegerProperty unbind.

Prototype

void unbind();

Source Link

Document

Remove the unidirectional binding for this Property .

Usage

From source file:Main.java

public static void main(String[] args) {
    IntegerProperty intProperty = new SimpleIntegerProperty(1024);
    IntegerProperty otherProperty = new SimpleIntegerProperty(0);

    otherProperty.bind(intProperty);//from   w ww.j  ava  2s  .c  om
    intProperty.set(7168);
    otherProperty.unbind();
    intProperty.set(8192);

}

From source file:Main.java

public static void main(String[] args) {
    // Create three properties
    IntegerProperty x = new SimpleIntegerProperty(10);
    IntegerProperty y = new SimpleIntegerProperty(20);
    IntegerProperty z = new SimpleIntegerProperty(60);

    // Create the binding z = x + y
    z.bind(x.add(y));/*from  w ww.  ja va 2s .  c  o m*/

    System.out.println("After binding z: Bound = " + z.isBound() + ", z = " + z.get());

    // Change x and y
    x.set(15);
    y.set(19);
    System.out.println("After changing x and y: Bound = " + z.isBound() + ", z = " + z.get());

    // Unbind z
    z.unbind();

    // Will not affect the value of z as it is not bound
    // to x and y anymore
    x.set(100);
    y.set(200);
    System.out.println("After unbinding z: Bound = " + z.isBound() + ", z = " + z.get());
}