Skip to content

Instantly share code, notes, and snippets.

@RupprechJo
Created November 25, 2013 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RupprechJo/7646831 to your computer and use it in GitHub Desktop.
Save RupprechJo/7646831 to your computer and use it in GitHub Desktop.
//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