import com.sun.javafx.runtime.VersionInfo; import javafx.application.Application; import javafx.application.Platform; 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.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Created with IntelliJ IDEA. * User: slugovoy * Date: 26.09.13 * Time: 16:01 * To change this template use File | Settings | File Templates. */ public class TabMinTest extends Application { private String style = "-fx-tab-min-width:100px;"; /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { BorderPane pane = new BorderPane(); final TabPane node = new TabPane(); Tab tab = new Tab(); tab.setText("tab 1"); HBox content1 = new HBox(10); content1.getChildren().addAll(new Button("Button"), new Label("Label"), new Rectangle(40, 40, Color.TOMATO)); tab.setContent(content1); Tab tab2 = new Tab(); tab2.setText("tab 2"); tab2.setContent(new Circle(40, Color.RED)); node.getTabs().addAll(tab, tab2); node.setFocusTraversable(false); Executors.newScheduledThreadPool(1).schedule(new Runnable() { @Override public void run() { Platform.runLater(new Runnable() { @Override public void run() { node.setStyle(style); System.out.println("style is set"); } }); } }, 5, TimeUnit.SECONDS); pane.setCenter(new VBox(50) {{ getChildren().addAll(new Button("Button"), node); setFillWidth(false); }}); Scene scene = new Scene(pane, 500, 400); stage.setScene(scene); stage.show(); stage.setTitle(VersionInfo.getRuntimeVersion()); } }