FXML expression binding scope

Greg Brown greg.x.brown at oracle.com
Mon May 21 10:16:00 PDT 2012


> <Label fx:id="label" text="more" managed="${visible}"/>


Another thing to consider is that the above markup translates roughly into the following Java code:

  label.managedProperty().bind(visibleProperty());

This would create a binding between the "managed" property and the "visible" property of the calling class, which is not what you want. The Java equivalent for the binding you want is this:

  label.managedProperty().bind(label.visibleProperty());

which translates to the following in FXML:

  <Label fx:id="label" text="more" managed="${label.visible}"/>

G



More information about the openjfx-dev mailing list