Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8094536

FXMLLoader doesn't inject @FXML with custom Controller Callback Factory

XMLWordPrintable

      Created a simple JavaFX application with FXML in NetBeans and modified my start method to use a custom callback to provide the Controller class. Fields/Methods with @FXML are not being injected. Need a workaround, and a fix.

          @Override
          public void start(Stage stage) throws Exception {
              FXMLLoader fxmll = new FXMLLoader(null, null, null, (clazz) -> FXMLDocumentController.class);
              Parent root = fxmll.load(getClass().getResourceAsStream("FXMLDocument.fxml"));
              Scene scene = new Scene(root);
              stage.setScene(scene);
              stage.show();
          }

            msladecek Martin Sládeček
            bborges Bruno Borges (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: