RFR: 8190411: NPE in SliderSkin:140 if Slider.Tooltip.autohide is true [v5]
Kevin Rushforth
kcr at openjdk.org
Wed Dec 7 17:17:41 UTC 2022
On Wed, 7 Dec 2022 05:46:23 GMT, Karthik P K <kpk at openjdk.org> wrote:
>> 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.
Thanks for the explanation. I don't have a better suggestion than what you propose, so let's proceed. It might be good to check whether the property is bound and skip setting it in the unlikely event that it is (save/restore the binding might be tricky and not something I can recall ever doing).
-------------
PR: https://git.openjdk.org/jfx/pull/965
More information about the openjfx-dev
mailing list