RFR: 8190411: NPE in SliderSkin:140 if Slider.Tooltip.autohide is true [v2]

Ambarish Rapte arapte at openjdk.org
Fri Dec 2 13:14:33 UTC 2022


On Fri, 2 Dec 2022 11:11:58 GMT, Karthik P K <duke at openjdk.org> wrote:

>> Cause: When slider is dragged for first time after tooltip appears, setOnMousePressed event was not invoked, hence dragStart was null in the subsequently invoked event handler (setOnMouseDragged).
>> 
>> Fix: Initialized dragStart in initialize method.
>> 
>> Test: Added system test to validate the fix.
>> 
>> Note: Initializing dragStart in layoutChildren method as suggested in the bug was causing side effects. Hence initialized dragStart in initialize method.
>
> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review comments

modules/javafx.controls/src/main/java/javafx/scene/control/skin/SliderSkin.java line 346:

> 344:         thumb.getStyleClass().setAll("thumb");
> 345:         thumb.setAccessibleRole(AccessibleRole.THUMB);
> 346:         dragStart = new Point2D(thumb.getLayoutX(), thumb.getLayoutY());

`dragStart` should be the exact mouse position where mouse pressed has occurred.
With this change mouse gets moved to the layout X, Y position of thumb, even though the mouse press occurred at any other location inside the thumb.

-------------

PR: https://git.openjdk.org/jfx/pull/965


More information about the openjfx-dev mailing list