I would like to override FXMLLoader. How can I do that?

随声附和 提交于 2019-12-13 21:23:05

问题


As explained on oracle forum, I would like to create a generic controller for my FXML's. (See a this post).

To do this, i would like to "override" FXMLLoader.java

What would i do ? I suppose i have to find the JavaFX original source, modify it and rebuild it as a .jar file.

I found the source code of JavaFX (http://hg.openjdk.java.net/openjfx/8/master/rt/) but i don't understand how to build it and to add it in my Eclipse project.

As i'm starting a new project, I can choose another IDE if necessary.

Thanks for your help


回答1:


FXMLLoader source link

Copy the loader source into your project, rename it, modify it's functionality and use an instance of your custom loader when loading FXML.

You don't need to build the entire OpenJDK or OpenJFX projects to accomplish this, just copy, paste and modify one class.



来源:https://stackoverflow.com/questions/19097943/i-would-like-to-override-fxmlloader-how-can-i-do-that

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!