TWaver With JavaFX(三)

2014-11-24 09:39:59 · 作者: · 浏览: 6
Group root = new Group();
101 Scene scene = new Scene(root, Color.ALICEBLUE);
102 VBox vbox=new VBox();
103 vbox.setPrefWidth(300);
104 vbox.setPrefHeight(20);
105 HBox hbox=new HBox();
106 nameText=new Text();
107 hbox.getChildren().add(new Label(" Name:"));
108 hbox.getChildren().add(nameText);
109 hbox.getChildren().add(new Text(" "));
110 locationText=new Text();
111 hbox.getChildren().add(new Label("Location:"));
112 hbox.getChildren().add(locationText);
113 vbox.getChildren().add(hbox);
114 root.getChildren().add(vbox);
115 return (scene);
116 }
117
118 public static void main(String[] args) {
119 SwingUtilities.invokeLater(new Runnable() {
120 @Override
121 public void run() {
122 initAndShowGUI();
123 }
124 });
125 }
126 }