import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

public class Test extends Application {

    @Override
    public void start(Stage primaryStage) {
        TabPane tabPane = new TabPane();

        for (int i = 0; i < 50; i++) {
            Tab tab = new Tab("T_" + i);

            //Add a custom graphic, this will not be visible in the drop-down menu
            Rectangle rectangle = new Rectangle(128, 16);
            rectangle.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
            tab.setGraphic(rectangle);

            tabPane.getTabs().add(tab);
        }

        StackPane root = new StackPane(tabPane);
        Scene scene = new Scene(root, 400, 300);

        primaryStage.setTitle("JavaFX TabPane with Custom Graphics");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

}
