JavaFX Script With Eclipse 入门2
来源:岁月联盟
时间:2008-07-20
右击JavaFXapp > New > Other
在New窗口中选择JavaFX > JavaFX File,
点击Next,在File name输入:HelloWorld.fx,
点击Finish,HelloWorld.fx就被添加到JavaFXapp工程中,并且在右边自动被打开了。
将下面代码粘贴到HelloWorld.fx中:
import javafx.ui.*;
Frame {
title: "Hello World JavaFX"
width: 200
height: 50
content: Label {
text: "Hello World"
}
visible: true
}
运行我们的第一个JavaFX程序
现在让我们用Eclipse运行我们的第一个JavaFX程序。
在Eclipse主菜单,选择Run > Run...: