5757import javafx .event .EventHandler ;
5858import javafx .geometry .Bounds ;
5959import javafx .geometry .HPos ;
60+ import javafx .geometry .Orientation ;
6061import javafx .geometry .Point2D ;
6162import javafx .geometry .Pos ;
6263import javafx .geometry .Side ;
@@ -292,7 +293,11 @@ public TabPaneSkin(TabPane control) {
292293 // The TabPane can only be as wide as it widest content width.
293294 double maxw = 0.0 ;
294295 for (TabContentRegion contentRegion : tabContentRegions ) {
295- maxw = Math .max (maxw , snapSizeX (contentRegion .prefWidth (-1 )));
296+ double dependentHeight = contentRegion .getContentBias () == Orientation .VERTICAL
297+ ? Math .max (0 , contentRegion .prefHeight (-1 ) - topInset - bottomInset )
298+ : -1 ;
299+
300+ maxw = Math .max (maxw , snapSizeX (contentRegion .prefWidth (dependentHeight )));
296301 }
297302
298303 final boolean isHorizontal = isHorizontal ();
@@ -310,7 +315,11 @@ public TabPaneSkin(TabPane control) {
310315 // The TabPane can only be as high as it highest content height.
311316 double maxh = 0.0 ;
312317 for (TabContentRegion contentRegion : tabContentRegions ) {
313- maxh = Math .max (maxh , snapSizeY (contentRegion .prefHeight (-1 )));
318+ double dependentWidth = contentRegion .getContentBias () == Orientation .HORIZONTAL
319+ ? Math .max (0 , contentRegion .prefWidth (-1 ) - leftInset - rightInset )
320+ : -1 ;
321+
322+ maxh = Math .max (maxh , snapSizeY (contentRegion .prefHeight (dependentWidth )));
314323 }
315324
316325 final boolean isHorizontal = isHorizontal ();
0 commit comments