Change Tab's Size of TabPane in JavaFX
As far as I know the width and height of elements are read-only. You can set -fx-pref-width, -fx-pref-height, -fx-max-width, -fx-min-width, -fx-max-height, -fx-min-height ,-fx-border-width and -fx-border-height to adjust the size of Java FX elements.
You can do what you want by using Css:
.tab {
-fx-pref-width: 250
}
.tab-header-background {
-fx-background-color:transparent
}
.tab-pane{
-fx-padding: 0 -1 -1 -1
}
We can set minimum/maximum width/height for all Tabs on TabPane.
@FXML
TabPane tabPane;
and somewhere:
tabPane.setTabMinWidth(33);
tabPane.setTabMinHeight(33);
tabPane.setTabMaxWidth(69);
tabPane.setTabMaxHeight(69);