diff -r 5563905417bb -r f91798831668 javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TabPaneSkin.java --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TabPaneSkin.java Wed Jan 02 13:05:34 2013 +0100 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TabPaneSkin.java Thu Jan 03 09:03:19 2013 +0100 @@ -61,7 +61,9 @@ import javafx.scene.input.MouseButton; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Pane; +import javafx.scene.layout.Region; import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.transform.Rotate; import javafx.util.Duration; @@ -919,6 +921,10 @@ updateGraphicRotation(); + final int padding = 2; + final Region focusIndicator = new Region(); + focusIndicator.getStyleClass().add("focus-indicator"); + inner = new StackPane() { @Override protected void layoutChildren() { Side tabPosition = getSkinnable().getSide(); @@ -929,8 +935,11 @@ double w = getWidth() - paddingLeft + paddingRight; double h = getHeight() - paddingTop + paddingBottom; - double labelWidth = snapSize(label.prefWidth(-1)); - double labelHeight = snapSize(label.prefHeight(-1)); + double prefLabelWidth = snapSize(label.prefWidth(-1)); + double prefLabelHeight = snapSize(label.prefHeight(-1)); + + double labelAreaWidth = prefLabelWidth; + double labelAreaHeight = prefLabelHeight; double closeBtnWidth = showCloseButton() ? snapSize(closeBtn.prefWidth(-1)) : 0; double closeBtnHeight = showCloseButton() ? snapSize(closeBtn.prefHeight(-1)) : 0; double minWidth = snapSize(getSkinnable().getTabMinWidth()); @@ -938,36 +947,43 @@ double minHeight = snapSize(getSkinnable().getTabMinHeight()); double maxHeight = snapSize(getSkinnable().getTabMaxHeight()); - double childrenWidth = labelWidth + closeBtnWidth; - double childrenHeight = Math.max(labelHeight, closeBtnHeight); + double childrenWidth = labelAreaWidth + closeBtnWidth; + double childrenHeight = Math.max(labelAreaHeight, closeBtnHeight); + double labelWidth = prefLabelWidth; + double labelHeight = prefLabelHeight; + if (childrenWidth > maxWidth && maxWidth != Double.MAX_VALUE) { + labelAreaWidth = maxWidth - closeBtnWidth; labelWidth = maxWidth - closeBtnWidth; } else if (childrenWidth < minWidth) { - labelWidth = minWidth - closeBtnWidth; + labelAreaWidth = minWidth - closeBtnWidth; } if (childrenHeight > maxHeight && maxHeight != Double.MAX_VALUE) { + labelAreaHeight = maxHeight; labelHeight = maxHeight; } else if (childrenHeight < minHeight) { - labelHeight = minHeight; + labelAreaHeight = minHeight; } if (animating) { - if (prefWidth.getValue() < labelWidth) { - labelWidth = prefWidth.getValue(); + if (prefWidth.getValue() < labelAreaWidth) { + labelAreaWidth = prefWidth.getValue(); } closeBtn.setVisible(false); } else { closeBtn.setVisible(showCloseButton()); } + label.resize(labelWidth, labelHeight); - + + double labelStartX = paddingLeft; double closeBtnStartX = (maxWidth != Double.MAX_VALUE ? maxWidth : w) - paddingRight - closeBtnWidth; - positionInArea(label, labelStartX, paddingTop, labelWidth, h, + positionInArea(label, labelStartX, paddingTop, labelAreaWidth, h, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER); if (closeBtn.isVisible()) { @@ -975,11 +991,13 @@ positionInArea(closeBtn, closeBtnStartX, paddingTop, closeBtnWidth, h, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER); } + + focusIndicator.resizeRelocate(label.getLayoutX() - padding, Math.min(label.getLayoutY(), closeBtn.isVisible() ? closeBtn.getLayoutY() : Double.MAX_VALUE) - padding, labelWidth + closeBtnWidth + padding*2, Math.max(labelHeight,closeBtnHeight) + padding*2); } }; inner.getStyleClass().add("tab-container"); inner.setRotate(getSkinnable().getSide().equals(Side.BOTTOM) ? 180.0F : 0.0F); - inner.getChildren().addAll(label, closeBtn); + inner.getChildren().addAll(label, closeBtn, focusIndicator); getChildren().addAll(inner); diff -r 5563905417bb -r f91798831668 javafx-ui-controls/src/com/sun/javafx/scene/control/skin/caspian/caspian.css --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/caspian/caspian.css Wed Jan 02 13:05:34 2013 +0100 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/caspian/caspian.css Thu Jan 03 09:03:19 2013 +0100 @@ -2631,6 +2631,12 @@ -fx-background-radius: 5 5 0 0, 4 4 0 0; } +.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator { + -fx-border-style: segments(5,3) inside; + -fx-border-width: 1; + -fx-border-color: -fx-focus-color; +} + .tab-pane > .tab-header-area > .headers-region > .tab:disabled { -fx-opacity: -fx-disabled-opacity; }