Custom Components in Scenebuilder 2.0

白昼怎懂夜的黑 提交于 2019-12-07 12:22:51

问题


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

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.

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.

Any ideas?


回答1:


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

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.

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.

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



来源:https://stackoverflow.com/questions/23820671/custom-components-in-scenebuilder-2-0

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