简体   繁体   English

NetBeans中的javafx自动导入

[英]javafx auto-imports in netbeans

I installed Netbeans with Javafx. 我用Javafx安装了Netbeans。 When I create a new JavaFX project, the basic classes needed for the template are automatically imported ( javafx.scene.Scene, javafx.stage.Stage, etc). 当我创建一个新的JavaFX项目时,将自动导入模板所需的基本类(javafx.scene.Scene,javafx.stage.Stage等)。

When I want to import other javaFX features classes, such as javafx.scene.image.Image, I use the shortcut key combination (ctr + shift + i). 当我想导入其他javaFX功能类,例如javafx.scene.image.Image时,我使用快捷键组合(ctr + shift + i)。

However Netbeans only offers me to autocomplete with java.awt.Image. 但是Netbeans仅提供了使用java.awt.Image自动完成的功能。 If I start typing "javafx. " and then try to autocomplete (ctrl + space) it does not list anything, the javafx library is not recognized, and I have to manually type the import, even though I created a JavaFX project. 如果我开始输入“ javafx。”,然后尝试自动完成(ctrl +空格),它不会列出任何内容,则无法识别javafx库,即使我创建了JavaFX项目,也必须手动键入导入。

How should I deal with it? 我应该如何处理?

I have the same problem because i have two JDKs in my OS (1.7 and 1.8) and NetBeans selected JDK 1.7 and i change it to JDK 1.8 and my Problem solved 我遇到了同样的问题,因为我的操作系统中有两个JDK(1.7和1.8),并且NetBeans选择了JDK 1.7,然后将其更改为JDK 1.8,问题解决了。

Just Right click on your project -> select Library -> and change java Platform 只需右键单击您的项目->选择Library->并更改Java Platform

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM