I have been experimenting with the FXMLLoader
and using the setControllerFactory
method using a custom Callback
implementation.
javafx does the following in FXMLLoader:
try {
if (controllerFactory == null) {
setController(ReflectUtil.newInstance(type));
} else {
setController(controllerFactory.call(type));
}
} catch (InstantiationException exception) {
throw new LoadException(exception);
} catch (IllegalAccessException exception) {
throw new LoadException(exception);
}
so, yes, the oracle tutorial is incorrect.