JavaFX custom controller factory

前端 未结 1 2038
感情败类
感情败类 2021-02-14 08:38

I have been experimenting with the FXMLLoader and using the setControllerFactory method using a custom Callback implementation.

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-14 09:15

    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.

    0 讨论(0)
提交回复
热议问题