我想覆盖FXMLLoader。我怎样才能做到这一点? [英] I would like to override FXMLLoader. How can I do that?

查看:226
本文介绍了我想覆盖FXMLLoader。我怎样才能做到这一点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如oracle论坛上所解释的,我想为我的FXML创建一个通用控制器。 (参见这篇文章)。

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

要做到这一点,我想覆盖FXMLLoader.java

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

我该怎么办?我想我必须找到JavaFX原始源,修改它并将其重建为.jar文件。

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

我找到了JavaFX的源代码( http://hg.openjdk.java.net/openjfx/8/master/rt/ )但我不明白如何构建它并将其添加到我的Eclipse项目中。

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.

当我开始一个新项目时,我可以选择另一个IDE如有必要。

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

感谢您的帮助

推荐答案

FXMLLoader源链接

将加载程序源复制到项目中,重命名,修改其功能,并在加载FXML时使用自定义加载程序的实例。

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

您不需要构建整个OpenJDK或OpenJFX项目来完成此任务,只需复制,粘贴和修改一个类。

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

这篇关于我想覆盖FXMLLoader。我怎样才能做到这一点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆