May 2018
Intermediate to advanced
268 pages
6h 43m
English
Bidirectional binding, meanwhile, has much fewer restrictions, because it ties properties harder, so there is no need to extra control them.
You can use setters:
label2.textProperty().bindBidirectional(label.textProperty()); label2.setText("hi");
You can combine bidirectional and regular bindings:
lblWidth.textProperty().bind(stage.widthProperty().asString()); lblWidth2.textProperty().bindBidirectional(lblWidth.textProperty());
And, you can bind one property bidirectionally several times:
label.textProperty().bindBidirectional(label2.textProperty()); label.textProperty().bindBidirectional(label3.textProperty()); label.setText("hi"); // or label2.setText("hi"); or label3.setText("hi"); // any of them will update all ...Read now
Unlock full access