场景构建器删除fxml文件中的导入 [英] Scene builder removes imports in fxml file

查看:90
本文介绍了场景构建器删除fxml文件中的导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用场景构建器(Gluon Scene Builder-JavaFX Scene Builder 8.1.1)来创建应用程序的UI并使用Eclipse开发JavaFX.

I use scene builder (Gluon Scene Builder - JavaFX Scene Builder 8.1.1) to create the UI of my application and develop JavaFX with Eclipse.

现在...每次我在场景生成器中保存某些内容时,它都会从fxml文件中删除我自己的类的导入.有没有一种方法可以告诉场景生成器这些类属于项目,从而避免这种行为?

Now... every time I save something in scene builder it removes the imports of my own classes from the fxml file. Is there a way to tell scene builder that those classes belong to the project to avoid this behavior?

推荐答案

为了让SceneBuilder处理自定义控件,您需要在类中添加jar,以便可以将其加载到其类路径中.

In order for SceneBuilder to deal with custom controls, you need to add the jar with your classes, so it can be loaded in its classpath.

如果不添加,则无法解析FXML文件上的导入,SceneBuilder将删除它们.

If you don't add it, the imports on your FXML file can't be resolved, and SceneBuilder will remove them.

要添加jar,请转到左上角的库"面板,然后在搜索"字段的右侧,单击小引擎按钮.选择Import JAR/FXML Files...,找到您的jar,然后单击导入.您可以选择可以添加该jar的哪些组件.

To add the jar, go to the Library panel on the top-left, and to the right of the Search field, click the little engine button. Select Import JAR/FXML Files..., find your jar and click import. You can select what components of that jar can be added.

然后,将罐子添加到Custom Library Folder,您可以单击同一引擎按钮,然后选择Custom Library Folder->Reveal in Explorer.

After that, the jar is added to a Custom Library Folder, that you can find clicking on the same engine button, and selecting Custom Library Folder->Reveal in Explorer.

如果对jar进行更改,请确保通过该菜单导入该版本或直接将其复制到该文件夹​​中,从而更新该文件夹中的版本.

If you make changes to your jar, make sure you update the version at that folder, either by importing it through that menu, or by copying it directly to that folder.

这篇关于场景构建器删除fxml文件中的导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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