Created
April 13, 2017 19:21
-
-
Save omernaci/4a4f171a777a8bdad5b188bf7930b092 to your computer and use it in GitHub Desktop.
JavaFX Binding Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Main.java class | |
import javafx.beans.binding.NumberBinding; | |
import javafx.beans.property.IntegerProperty; | |
import javafx.beans.property.SimpleIntegerProperty; | |
/** | |
* | |
* @author omers | |
*/ | |
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()); | |
} | |
} | |
// Output : | |
// 3 | |
// 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment