RFR: 6672644: JComboBox still scrolling if switch to another window and return back [v4]

Damon Nguyen dnguyen at openjdk.org
Wed Nov 20 07:20:05 UTC 2024


On Tue, 19 Nov 2024 08:37:54 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> <img width="394" alt="Screenshot 2024-11-12 at 9 46 35 AM" src="https://github.com/user-attachments/assets/2dafc132-e406-4b5b-a03c-17239c02313b">
>> 
>> Here's an example of the fix WITHOUT the `doClick` on Metal L&F. The JComboBox menu isn't auto-scrolling but the down-arrow button still looks pressed.
>> 
>> <img width="399" alt="Screenshot 2024-11-12 at 9 49 17 AM" src="https://github.com/user-attachments/assets/c923ebd9-bbcb-47cf-bd54-56ddbe865c31">
>> 
>> And here's the same example but WITH the `doClick`. More as I'd expect from the behavior.
>
> What if we dont press on down-arrow button but press on the down viewport area, in which case doesn't it get reproduced?
> Also doClick spec says 
> 
> "Programmatically perform a "click". This does the same
>      * thing as if the user had pressed and released the button.
>      * The button stays visually "pressed" for <code>pressTime</code>
>      *  milliseconds."
> 
> which does not seem to be right for this case..
> What if you try to check button isPressed() and if so, do button setPress(false)?

Didn't think about that scenario. `isPressed()` definitely makes more sense then. I've updated it to that.

Tested it and seems to work just as well. Thanks for the suggestion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20845#discussion_r1849675306


More information about the client-libs-dev mailing list