RT-24228: Add RTL support to Scrollbar / ScrollPane diff -r 156774e6fa98 javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java Mon Nov 26 14:35:06 2012 +0000 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java Mon Nov 26 11:36:18 2012 -0800 @@ -271,6 +271,7 @@ if (scrollNode != null) { viewContent.getChildren().add(scrollNode); + viewRect.nodeOrientationProperty().bind(scrollNode.nodeOrientationProperty()); } getChildren().clear(); @@ -380,6 +381,9 @@ */ if (hsb.getVisibleAmount() > 0.0 && hsb.getVisibleAmount() < hsb.getMax()) { if (Math.abs(deltaX) > PAN_THRESHOLD) { + if (isReverseNodeOrientation()) { + deltaX = -deltaX; + } double newHVal = (ohvalue + deltaX / (nodeWidth - viewRect.getWidth()) * (hsb.getMax() - hsb.getMin())); if (!PlatformUtil.isEmbedded()) { if (newHVal > hsb.getMax()) { @@ -894,6 +898,12 @@ } } + private boolean isReverseNodeOrientation() { + return (scrollNode != null && + getSkinnable().getEffectiveNodeOrientation() != + scrollNode.getEffectiveNodeOrientation()); + } + private boolean determineHorizontalSBVisible() { final double contentw = getSkinnable().getWidth() - getInsets().getLeft() - getInsets().getRight(); if (PlatformUtil.isEmbedded()) { @@ -982,7 +992,8 @@ } private double updatePosX() { - viewContent.setLayoutX(snapPosition(getInsets().getLeft() - posX / (hsb.getMax() - hsb.getMin()) * (nodeWidth - contentWidth))); + double x = isReverseNodeOrientation() ? (hsb.getMax() - (posX - hsb.getMin())) : posX; + viewContent.setLayoutX(snapPosition(getInsets().getLeft() - x / (hsb.getMax() - hsb.getMin()) * (nodeWidth - contentWidth))); getSkinnable().setHvalue(Utils.clamp(getSkinnable().getHmin(), posX, getSkinnable().getHmax())); return posX; }