简体   繁体   English

如何在Eclipse Juno中使用JavaFX?

[英]How do I work with JavaFX in Eclipse Juno?

I have installed jdk1.7.0_15 . 我已经安装了jdk1.7.0_15

JavaFX's download page says the following: JavaFX的下载页面说明如下:

JavaFX 2.2.7 contains the latest security fixes and is co-bundled with the latest JDK 7 for Windows, Mac and Linux. JavaFX 2.2.7包含最新的安全修复程序,并与最新的Windows,Mac和Linux JDK 7捆绑在一起。
Download Java SE 7 with JavaFX 2.2.7 使用JavaFX 2.2.7下载Java SE 7

Like a good noob, I followed the instructions and installed the JDK. 就像一个好的菜鸟,我按照说明安装了JDK。 Now when I look for jfxrt.jar file that I can import to Eclipse as a user library, I can not find it. 现在,当我查找可以作为用户库导入Eclipse的jfxrt.jar文件时,我找不到它。 There are a few other JavaFX related libraries in JDK's lib folder but I do not understand what to import next. JDK的lib文件夹中还有一些其他JavaFX相关库,但我不明白接下来要导入什么。

Most of the tutorials on Google, including the one by Java, are very old. Google上的大多数教程(包括Java编写的教程)都非常陈旧。
Please help me get started with JavaFX 请帮助我开始使用JavaFX

I recommend using e(fx)clipse . 我建议使用e(fx)clipse

e(fx)clipse is a plugin to assist JavaFX development in Eclipse which will fix your classpath issue and provide you with many other useful features as well as step by step documentation and code completion assistance. e(fx)clipse是一个帮助Eclipse中JavaFX开发的插件,它将修复您的类路径问题,并为您提供许多其他有用的功能以及分步文档和代码完成帮助。

Great question. 好问题。 I remember having the same problem when I started. 我记得当我开始时遇到同样的问题。 Here is a little step by step guide. 这是一个小步骤指南。

1) Make a new JavaFx project (This is actually the same as a Java project, it just comes with a more suitable skeleton) 1)创建一个新的JavaFx项目(这实际上与Java项目相同,它只是带有更合适的骨架)
2) If you're getting errors like 'Can't find javafx.application' add the jfxrt.jar by right clicking on the libraries and select 'Add folder/Jar' You will have to browse to your jdk folder and find jfxrt.jar. 2)如果你遇到'找不到javafx.application'这样的错误,可以通过右键单击库添加jfxrt.jar并选择'添加文件夹/ Jar'你必须浏览到你的jdk文件夹并找到jfxrt。罐。 Here is where it is located in my jdk: 这是它在我的jdk中的位置:
/jdk1.7.0_15/jre/lib/jfxrt.jar
3) For the third step I suggest checking out this example. 3)对于第三步,我建议查看这个例子。 This example comes with sample code and I used it to copy and paste till I got a little more comfortable in javafx. 这个例子带有示例代码,我用它来复制和粘贴,直到我在javafx中更舒服一点。

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

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