Eclipse Mars不会自动导入JavaFX [英] Eclipse Mars won't auto import JavaFX
问题描述
所以,对于每一个想要使用JavaFX 8组件的时间,我必须google确切包的名称,然后手动输入
code> import packageName;
我会详细介绍。
让我们想创建一个 StackPane
StackPane stackPane =新的StackPane(新的ImageView(this.getClass()。getResource(/ images / about_icon.png)。toString()));
stackPane.setAlignment(Pos.CENTER);
有几个类。当我在Mac中使用 ctrl + o
( cmd + o
)时,应该导入所需的包。 p>
但是它没有。
其实我必须google确切的名字 StackPane
。所以,我googled它,我发现它在 javafx.scene.layout.StackPane
所以,我do import javafx.scene.layout.StackPane;
StackPane已修复。
现在,Eclipse正在抱怨 ImageView
,我重复上述与ImageView相同的步骤。
等等。
如何改善?
我正在使用Eclipse Mars。 Jdk 8. Mac OS X El-Capitan。
您需要安装e(fx)剪辑才能开发JavaFX工具支持
为此
- 打开帮助 - >安装新软件
- 选择火星软件网站
之后您需要重新启动Eclipse,并且应该具有适当的JavaFX支持。So, for every freaking time I want to use JavaFX 8 component, I have to google the exact name of the package, and manually type
import packageName;
I'll put in more detail.
Let's say I want to create a
StackPane
StackPane stackPane = new StackPane(new ImageView(this.getClass().getResource("/images/about_icon.png").toString())); stackPane.setAlignment(Pos.CENTER);
Several classes there. When I use
ctrl + o
(cmd + o
in Mac), then it should import the required package.But it doesn't.
In fact, I have to google the exact name of
StackPane
. So, I googled it, I found it that it's underjavafx.scene.layout.StackPane
So, I do
import javafx.scene.layout.StackPane;
StackPane is fixed.
Now Eclipse is complaining about
ImageView
and I'm repeating the above same steps for ImageView.And so on.
How can this be improved?
I'm using Eclipse Mars. Jdk 8. Mac OS X El-Capitan.
解决方案You need to install e(fx)clipse in order to have JavaFX development tooling support.
For this
- Open Help -> Install New Software
- Select the Software Site for Mars http://download.eclipse.org/releases/mars
- Disable Group items by category (unfortunately the e(fx)clipse team forgot to add a category)
- Filter for e(fx)
- Select e(fx)clipse - IDE
- Next
- Next
- Accept the license
- Finish
After that you need to restart Eclipse and should have proper JavaFX support.
这篇关于Eclipse Mars不会自动导入JavaFX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!