@Override public void start(Stage primaryStage) { primaryStage.setTitle("JavaFX layouts samples"); Tab hboxTab = new Tab(); hboxTab.setText("HBox"); hboxTab.setClosable(false); hboxLayout.setBackground(createBackground(Color.LIGHTGREEN)); hboxTab.setContent(hboxLayout); Tab vboxTab = new Tab(); vboxTab.setText("VBox"); vboxTab.setClosable(false); vboxLayout.setBackground(createBackground(Color.ORANGE)); vboxTab.setContent(vboxLayout); Tab flowPaneTab = new Tab(); flowPaneTab.setText("FlowPane"); flowPaneTab.setClosable(false); flowLayout.setBackground(createBackground(Color.LIGHTSKYBLUE)); flowPaneTab.setContent(flowLayout); Tab gridPaneTab = new Tab("GridPane"); gridPaneTab.setClosable(false); gridLayout.setBackground(createBackground(Color.LIGHTCORAL)); gridLayout.setGridLinesVisible(true); gridPaneTab.setContent(gridLayout); Tab borderPaneTab = new Tab(); borderPaneTab.setText("BorderPane"); borderPaneTab.setClosable(false); borderLayout.setBackground(createBackground(Color.LIGHTYELLOW)); borderPaneTab.setContent(borderLayout); Tab stackPaneTab = new Tab(); stackPaneTab.setText("StackPane"); stackPaneTab.setClosable(false); stackLayout.setBackground(createBackground(Color.YELLOW)); stackPaneTab.setContent(stackLayout); Tab tilePaneTab = new Tab("TilePane"); tilePaneTab.setClosable(false); tileLayout.setBackground(createBackground(Color.LIGHTGOLDENRODYELLOW)); tilePaneTab.setContent(tileLayout); updateChildren(false); TabPane tabPane = new TabPane(); tabPane .getTabs() .addAll( hboxTab, vboxTab, flowPaneTab, gridPaneTab, borderPaneTab, stackPaneTab, tilePaneTab); VBox optionsPanel = new VBox(); CheckBox componentType = new CheckBox("Use Buttons instead of Rectangles"); componentType .selectedProperty() .addListener((observable, oldValue, newValue) -> updateChildren(newValue)); optionsPanel.getChildren().add(componentType); optionsPanel.setPadding(new Insets(10)); BorderPane mainLayout = new BorderPane(); mainLayout.setCenter(tabPane); mainLayout.setLeft(optionsPanel); // show the generated scene graph Scene scene = new Scene(mainLayout); primaryStage.setScene(scene); primaryStage.show(); }