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

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Nov 19 08:40:57 UTC 2024


On Tue, 12 Nov 2024 17:50:01 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> The scrollbar increase and decrease buttons stay visually clicked down. Trying to change `setFocusPainted` or `setSelected` didn't seem to resolve this. However, adding a `doClick` resolves it and doesn't seem to interfere with the positioning of the scrolled item.
>> 
>> To be sure, I ran this on CI on all OS's and I didn't run into an issue. I'm open to other suggestions for fixing this visually, but this seemed like the cleanest way to do so.
>
> <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)?

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

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


More information about the client-libs-dev mailing list