List of usage examples for javafx.beans.property IntegerProperty bind
void bind(ObservableValue<? extends T> observable);
From source file:Main.java
public static void main(String[] args) { IntegerProperty intProperty = new SimpleIntegerProperty(1024); IntegerProperty otherProperty = new SimpleIntegerProperty(0); otherProperty.bind(intProperty); intProperty.set(7168);/*from w w w .j ava2 s.c o m*/ 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)); System.out.println("After binding z: Bound = " + z.isBound() + ", z = " + z.get()); // Change x and y x.set(15);//w w w . j av a 2 s .co m 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()); }
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);/*from www . j ava2s . c om*/ i.set(2048); 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()); }