Eclipse Mars不会自动导入JavaFX [英] Eclipse Mars won't auto import JavaFX

查看:142
本文介绍了Eclipse Mars不会自动导入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工具支持



为此


  1. 打开帮助 - >安装新软件

  2. 选择火星软件网站
    之后您需要重新启动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 under javafx.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

    1. Open Help -> Install New Software
    2. Select the Software Site for Mars http://download.eclipse.org/releases/mars
    3. Disable Group items by category (unfortunately the e(fx)clipse team forgot to add a category)
    4. Filter for e(fx)
    5. Select e(fx)clipse - IDE
    6. Next
    7. Next
    8. Accept the license
    9. Finish

    After that you need to restart Eclipse and should have proper JavaFX support.

    这篇关于Eclipse Mars不会自动导入JavaFX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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