Scenebuilder 2.0中的自定义组件 [英] Custom Components in Scenebuilder 2.0

查看:372
本文介绍了Scenebuilder 2.0中的自定义组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Scenebuilder 1.1中,您可以整体导入整个自定义组件。

In Scenebuilder 1.1, you could import an entire custom component as a whole.

然而,在2.0中,它将组件作为单独的部分(容器和节点)导入。由于我的自定义组件依赖于统一使用其控制器和ID,这会破坏它。

In 2.0, however, it is importing the component as separate pieces (Container and nodes). Since my custom component relies on being unified to work with its controller and IDs, this breaks it.

我还能做些什么吗?我真的希望能够将Java 8和Scenebuilder 2.0用于其DatePicker。如果一个完整稳定的版本即将到来,也许我可以等待。我最好想避免使用hacky解决方案。

Is there anything I can do as of yet? I'd really like to be able to use Java 8 and Scenebuilder 2.0 for its DatePicker. If a full stable release is right around the corner, perhaps I can wait. I'd preferably want to avoid hacky solutions.

任何想法?

推荐答案

我只找到一种方法来处理这种反向兼容性:构建我自己的场景构建器。

I have only found one way to deal with this kind of back-compatibility: building my own scenebuilder.

它是官方开源的,所以你可以看看它例如,在bitbucket上使用mercurial。

It is officially open source so you can check it out with mercurial on bitbucket for instance.

然后构建它并修改它以将所有自定义组件和依赖项放在同一个类路径中,用于一个唯一的类加载器。

Then you build it and modify it to put all your custom components and dependencies in the same classpath for one unique classloader.

检查名为FXOMLLoader的类,它是使用类加载器的地方,我的修复是明确地只为所有组件使用一个类加载器,并将我的deps内部的几个库添加到类路径中它可以工作。

Check the class named FXOMLLoader, it is where the classloader is used, my fix was to explicitly only use one classloader for all components and adding a few repertories with my deps inside to the classpath for it to work.

我已经使用了Jar Class Loader库这样做了,它运行得很好。这很不好看。

I have used Jar Class Loader library to do so, and it works pretty well. This is pretty hacky though.

这篇关于Scenebuilder 2.0中的自定义组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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