changeset 7130:e76f5f5b0047

RT-32553 ScrollPane doesn't take the focus when pressing on the scroll bar Reviewed by: dgrieve
author Martin Sladecek <martin.sladecek@oracle.com>
date Tue, 27 May 2014 10:14:53 +0200
parents c1b0d1cbc280
children 0867438d36b7
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Mon May 26 14:20:36 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Tue May 27 10:14:53 2014 +0200
@@ -37,6 +37,7 @@
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.event.EventDispatcher;
+import javafx.event.EventHandler;
 import javafx.geometry.BoundingBox;
 import javafx.geometry.Bounds;
 import javafx.geometry.Orientation;
@@ -262,6 +263,13 @@
         vsb = new ScrollBar();
         vsb.setOrientation(Orientation.VERTICAL);
 
+        EventHandler<MouseEvent> barHandler = ev -> {
+            getSkinnable().requestFocus();
+        };
+
+        hsb.addEventFilter(MouseEvent.MOUSE_PRESSED, barHandler);
+        vsb.addEventFilter(MouseEvent.MOUSE_PRESSED, barHandler);
+
         corner = new StackPane();
         corner.getStyleClass().setAll("corner");