SimpleIntegerProperty and NumberBinding : NumberBinding « JavaFX « Java






SimpleIntegerProperty and NumberBinding

 

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.binding.NumberBinding;
 
public class Main {
 
    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);
        System.out.println(sum.getValue());
    }
}

   
  








Related examples in the same category

1.Create NumberBinding with IntegerProperty.multiply
2.Using the NumberBinding in the following Bindings