modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java
Print this page
@@ -272,37 +272,39 @@
/** {@inheritDoc} */
@Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
// The TabPane can only be as wide as it widest content width.
double maxw = 0.0;
for (TabContentRegion contentRegion: tabContentRegions) {
- maxw = Math.max(maxw, snapSize(contentRegion.prefWidth(-1)));
+ maxw = Math.max(maxw, snapSizeX(contentRegion.prefWidth(-1)));
}
final boolean isHorizontal = isHorizontal();
- final double tabHeaderAreaSize = snapSize(isHorizontal ?
- tabHeaderArea.prefWidth(-1) : tabHeaderArea.prefHeight(-1));
+ final double tabHeaderAreaSize = isHorizontal
+ ? snapSizeX(tabHeaderArea.prefWidth(-1))
+ : snapSizeY(tabHeaderArea.prefHeight(-1));
double prefWidth = isHorizontal ?
Math.max(maxw, tabHeaderAreaSize) : maxw + tabHeaderAreaSize;
- return snapSize(prefWidth) + rightInset + leftInset;
+ return snapSizeX(prefWidth) + rightInset + leftInset;
}
/** {@inheritDoc} */
@Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
// The TabPane can only be as high as it highest content height.
double maxh = 0.0;
for (TabContentRegion contentRegion: tabContentRegions) {
- maxh = Math.max(maxh, snapSize(contentRegion.prefHeight(-1)));
+ maxh = Math.max(maxh, snapSizeY(contentRegion.prefHeight(-1)));
}
final boolean isHorizontal = isHorizontal();
- final double tabHeaderAreaSize = snapSize(isHorizontal ?
- tabHeaderArea.prefHeight(-1) : tabHeaderArea.prefWidth(-1));
+ final double tabHeaderAreaSize = isHorizontal
+ ? snapSizeY(tabHeaderArea.prefHeight(-1))
+ : snapSizeX(tabHeaderArea.prefWidth(-1));
double prefHeight = isHorizontal ?
- maxh + snapSize(tabHeaderAreaSize) : Math.max(maxh, tabHeaderAreaSize);
- return snapSize(prefHeight) + topInset + bottomInset;
+ maxh + snapSizeY(tabHeaderAreaSize) : Math.max(maxh, tabHeaderAreaSize);
+ return snapSizeY(prefHeight) + topInset + bottomInset;
}
/** {@inheritDoc} */
@Override public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) {
Side tabPosition = getSkinnable().getSide();
@@ -316,11 +318,15 @@
@Override protected void layoutChildren(final double x, final double y,
final double w, final double h) {
TabPane tabPane = getSkinnable();
Side tabPosition = tabPane.getSide();
- double headerHeight = snapSize(tabHeaderArea.prefHeight(-1));
+ // There seem to be conflicting ways in which this dimension will
+ // be used below. Most places use it exclusively as a "height",
+ // but the two lines that follow, use it as either a width or a
+ // height...?
+ double headerHeight = snapSizeY(tabHeaderArea.prefHeight(-1));
double tabsStartX = tabPosition.equals(Side.RIGHT)? x + w - headerHeight : x;
double tabsStartY = tabPosition.equals(Side.BOTTOM)? y + h - headerHeight : y;
final double leftInset = snappedLeftInset();
final double topInset = snappedTopInset();