import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Side; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.TilePane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class TabPaneTest extends Application { TabPane[] tps = null; public void start(Stage stage) throws Exception { TilePane pane = new TilePane(10, 10); pane.setPrefColumns(2); tps = new TabPane[4]; CreateTP(0, "T"); CreateTP(1, "R"); CreateTP(2, "B"); CreateTP(3, "L"); tps[0].setSide(Side.TOP); tps[1].setSide(Side.RIGHT); tps[2].setSide(Side.BOTTOM); tps[3].setSide(Side.LEFT); pane.getChildren().addAll(tps); Scene scene = new Scene(pane, 800, 600); stage.setScene(scene); stage.show(); } // start private void CreateTP(int i, String s) { TabPane tp = new TabPane(); Tab tab1 = new Tab(); //"one"); tab1.setGraphic(new Label(s + " tab 1")); //n.b. text on tab always rotates, hence using 'graphic' tab1.setContent(new Rectangle(200, 200, Color.RED)); tp.getTabs().add(tab1); Tab tab2 = new Tab(); //"two"); tab2.setGraphic(new Label(s + " tab 2")); tab2.setContent(new Rectangle(200, 200, Color.BLUE)); tp.getTabs().add(tab2); tp.setStyle("-fx-border-color: black; -fx-border-width: 1"); /* try with and without this block ... tp.setTabMinWidth(90); tp.setTabMaxWidth(90); tp.setTabMinHeight(60); tp.setTabMaxHeight(60); */ // and with and without this next line //tp.setRotateGraphic(true); tps[i] = tp; } // CreateTP public static void main(String[] args) { Application.launch(args); } }