1

Looking at FXMLLoader#load, a "template flag" is mentioned - yet I see no explanation of how to set this flag. Presumably there should be a FXMLLoader#setTemplate, but no such method exists in the linked JavaDoc, and using the latest 1.8 OpenJDK (build 1.8.0_72-internal-b05) I can't see such method either.

So what is this flag, and how do I set it?

Itai
  • 6,641
  • 6
  • 27
  • 51

1 Answers1

2

There was some discussion on the JavaFX developer list about creating this flag in order to generate a better-performing mode for loading FXML files for certain use cases. It seems this idea was not included in the final release of JavaFX 8.0, but clearly the API documentation didn't fully reflect that decision.

So the actual answer to your question is that the API documentation is wrong: there is no such flag.

James_D
  • 201,275
  • 16
  • 291
  • 322
  • Thank you. Is there another way of making subsequent `load` calls faster, other than implementing my own `ClassLoader`? – Itai Dec 29 '15 at 03:37
  • Not that I'm aware of. Loading a scene graph from FXML is inherently quite slow (file or resource I/O and lots of reflection). Tom Schindl suggested the idea of [compiling FXML to Java classes](http://tomsondev.bestsolution.at/2013/08/29/convert-fxml-to-java-as-part-of-the-build/) as part of the build process, though I don't know how far this project went. I think I'd recommend just building anything where performance of initialization is important directly in Java, rather than FXML, though I understand the constraints on productivity that advice might impose. – James_D Dec 29 '15 at 03:51