12. Stage
Scene
VBox
HBox
TableView
Stage Scene VBox HBox Label
TextBox
Button
TableView
13. public class Hello extends Application {
@Override
Scene Graph の構築
public void start(Stage stage) {
// コンテナ
Group container = new Group();
// シーングラフのルート要素を生成し、コンテナを貼る
Scene scene = new Scene(container, 100, 20);
stage.setScene(scene);
// ラベルを生成しコンテナに貼る
Label label = new Label("Hello, World!");
container.getChildren().add(label);
}
stage.show();
stage.setVisible(true);
SceneGraph
public static void main(String[] args) {
Application.launch(args);
}
}
14. Java
public void start(Stage stage) {
stage.setTitle("Custom Browser");
VBox vbox = new VBox(10);
vbox.setLayoutY(10);
Scene scene = new Scene(vbox, 800, 600);
HBox hbox = new HBox(10);
hbox.setAlignment(Pos.CENTER);
TextField field = new TextField();
field.setPrefWidth(400);
hbox.getChildren().add(field);
Button button = new Button("Load");
hbox.getChildren().add(button);
vbox.getChildren().add(hbox);
WebView view = new WebView();
vbox.getChildren().add(view);
stage.setScene(scene);
stage.show();
}