Created
November 25, 2013 19:06
-
-
Save RupprechJo/7646831 to your computer and use it in GitHub Desktop.
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
//Binding with the bind method of a property | |
StringProperty prop1 = new SimpleStringProperty(); | |
StringProperty prop2 = new SimpleStringProperty(); | |
prop1.bind(prop2); | |
prop2.set("Hello World"); | |
Assert.assertEquals(prop1.get(), prop2.get()); | |
//Binding with Bindings.add method | |
IntegerProperty int1 = new SimpleIntegerProperty(); | |
IntegerProperty int2 = new SimpleIntegerProperty(); | |
NumberBinding sum = Bindings.add(int1, int2); | |
int1.set(2); | |
int2.set(3); | |
Assert.assertEquals(5, sum.getValue().intValue()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment