/** * Copyright (c) 2008, 2012 Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. */ import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.geometry.Side; import javafx.scene.layout.BorderPane; /** * An implementation of tabs using the TabPane class. * * @see javafx.scene.control.TabPane * @see javafx.scene.control.Tab * @see javafx.scene.control.TabPane */ public class TabSample extends Application { private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setScene(new Scene(root, 400, 300)); primaryStage.setTitle("TabPane Test (" + System.getProperty("javafx.runtime.version") + ")"); BorderPane borderPane = new BorderPane(); TabPane tabPane = new TabPane(); tabPane.setPrefSize(200, 300); tabPane.setSide(Side.TOP); for (int i = 0; i < 10; i++) { tabPane.getTabs().add(new Tab("Tab " + tabPane.getTabs().size())); } borderPane.setCenter(tabPane); root.getChildren().add(borderPane); } @Override public void start(Stage primaryStage) throws Exception { init(primaryStage); primaryStage.show(); } public static void main(String[] args) { launch(args); } }