在Netbeans Platform应用程序中使用JavaFX [英] Using JavaFX in a Netbeans Platform application

查看:273
本文介绍了在Netbeans Platform应用程序中使用JavaFX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试开始在 TopComponent 中开发一个持有 JFXPanel 的NB平台应用程序。不幸的是,当实例化 JFXPanel 时,会在运行时抛出异常。我看到这是因为我的项目的子目录中没有JavaFX本机库(如glass.dll)。

I tried to start developing an NB platform application that holds a JFXPanel in a TopComponent. Unfortunately, an Exception is thrown at runtime when the JFXPanel is instantiated. I saw that it's because i don't have the JavaFX native libs (like glass.dll) in the sub-directories of my project.

在我尝试解决之前只是通过复制文件的问题,我想问你是否有更好的方法。在我看来,我不应该将本机库复制到我的项目中,因为它们应该由我的应用程序安装到的系统提供。

Before i try to solve the problem just by copying the files, I'd like to ask you if there is a better way. In my opinion, i shouldn't have to copy the native libs into my project because they should be delivered by the system my app is installed to.

推荐答案


  1. 您是如何将JavaFX依赖项添加到Java项目的?通常的方法是将jfxrt.jar添加到依赖项中,在这种情况下,将自动捕获本机库。

  1. How did you added JavaFX dependency to your Java project? Usual way is to add jfxrt.jar to dependencies, and in this case native libs will be caught automatically.

另一个原因可能是lib的错误行为Netbeans的复制选项。右键单击项目,然后转到属性 - >构建 - >打包并取消选中复制从属库选项。

Another reason may be the wrong behavior of the lib copy option of Netbeans. Right click on project, then go to Properties -> Build -> Packaging and uncheck Copy Dependent Libraries option.

您也可以尝试要下载 JavaFX示例,请打开Swing Interoperability App并查看该项目如何运作。

Also you can try to download JavaFX Samples, open "Swing Interoperability App" and see how that project works.

这篇关于在Netbeans Platform应用程序中使用JavaFX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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