Is it possible to bind FXML property bindings ( disable="${myNode.disable}" to bind the disable property to myNode with a disabled value) from the script itself?
The only way I could do this was to manually edit the output file. Here is an example:
<?xml version="1.0" encoding="UTF-8"?> <?import javafx.geometry.Insets?> <?import javafx.scene.control.CheckBox?> <?import javafx.scene.control.TextField?> <?import javafx.scene.layout.VBox?> <VBox spacing="10.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1"> <children> <TextField disable="${checkbox.selected}"/> <CheckBox fx:id="checkbox" mnemonicParsing="false" text="Disable Field" /> </children> <opaqueInsets> <Insets /> </opaqueInsets> <padding> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </padding> </VBox>
And loaded:
import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class App extends Application { @Override public void start(Stage primaryStage) throws Exception { VBox parent = FXMLLoader.load(getClass().getResource("FxmlBindingTest.fxml")); Scene scene = new Scene(parent); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
When I load this file into the scene constructor, there is a yellow caution icon above the node:

Which is really interesting, if I load the preview from the scene creator, the values ββare not related.
Scene Designer will not overwrite or delete anchor text for any changes other than changing this property, as expected.
source share