学习的最好方法就是先看一下hello word 的创建dom 然后再看api 最后再各种度娘,谷歌..
第一步环境
首先去oracle 下载 fx 的sdk 或者下载jdk7 他包含了 fx sdk 然后创建工程导入jfxtr.jar 在sdk里边找
直接上代码吧.
public class Test extends Application {
private void init(Stage primaryStage) {
Group root = new Group();//一个面板
primaryStage.setResizable(false);//是否可以拖动大小
primaryStage.setScene(new Scene(root,550,150));//设置场景的宽高
Text text=new Text(100,100,"hello word");//字体的定位
text.setFont(new Font(50));//字体大小
root.getChildren().add(text);
}
@Override
public void start(Stage primaryStage) throws Exception {
init(primaryStage);
primaryStage.show();
}
public static void main(String[] args) { launch(args); }
}