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

Karthik P K kpk at openjdk.org
Wed Dec 7 05:48:29 UTC 2022


On Tue, 6 Dec 2022 23:21:55 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review comment. Add comments for changes
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/SliderSkin.java line 404:
> 
>> 402:                 // This is done to receive mouse pressed event on thumb and
>> 403:                 // inturn to detect start of drag.
>> 404:                 t.setConsumeAutoHidingEvents(false);
> 
> In general, I'm not in favor of setting the value of a public property (for a few reasons). Have you considered alternative approaches? One thing to note is that this will be ineffective if the app binds to the `consumeAutoHidingEvents` property (unlikely as that might be).

I considered following 2 approaches.

1.  Initializing `dragStart` in `layoutChildren` method as suggested in the bug. With this approach I was not able to get the exact mouse click position on the thumb. Thumb was lagging behind the cursor while dragging and thumb was also flickering when initialized with (`layoutX`, `layoutY`) values.
2. Initializing `dragStart` in `initialize` method. In this case also I was not able to get the mouse click position on the thumb. Tried initializing thumb with `layoutX` and `layoutY` values, this causes side effect of cursor moving to the (`layoutX`, `layoutY`) on dragging the thumb.
Because of these side effects, considered above approach.
Please let me know if you have any suggestions.

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

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


More information about the openjfx-dev mailing list