2
在JavaFX property中可以綁定到某個observable value。在JavaFX中有沒有類似於通過fxml的屬性綁定?
Label l = new Label();
l.visibleProperty().bind(l.textProperty().length().isEqualTo(3));
l.setText("123"); // show label
l.setText("1234"); // hide label
最近我發現綁定不僅可以在代碼中完成,而且可以在FXML標記文檔中完成。
<!-- Label is visible only if input is visible. -->
<Label l="Please input some value:" visible="${value.visible}" />
<TextField fx:id="value" />
在另一種語言和標記工具中是否有類似的功能,或者這種類型的oracle創新? :-)
更新:我添加了XAML標籤,因爲我猜它有類似的東西。