RFR: 8344981: [REDO] JDK-6672644 JComboBox still scrolling if switch to another window and return back [v5]

Abhishek Kumar abhiscxk at openjdk.org
Wed Feb 19 06:37:56 UTC 2025


On Wed, 19 Feb 2025 00:08:09 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> Redo for JComboBox infinite scrolling issue. The issue is that when a scrollbar is clicked and held, if the user switches focus (ex: ALT+TAB) while scrolling, when focused is returned to the scrolling application, the JComboBox will still be scrolling even though nothing it being clicked.
>> 
>> Previously, a KeyboardFocusListener was added to determine the focus. However, there was a memory leak on Windows and Ubuntu. This current implementation uses the current FocusManager and is overall a cleaner, simpler approach.
>> 
>> CI testing is green on all platforms.
>
> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add helper method

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java line 1667:

> 1665: 
> 1666:     private void stopScrollTimer(ActionEvent e) {
> 1667:         ((Timer)e.getSource()).stop();

minor spacing
Suggestion:

        ((Timer) e.getSource()).stop();

test/jdk/javax/swing/JComboBox/JComboBoxScrollFocusTest.java line 44:

> 42:  * @bug 6672644
> 43:  * @library /java/awt/regtesthelpers
> 44:  * @build PassFailJFrame

No longer needed for automated test.

test/jdk/javax/swing/JComboBox/JComboBoxScrollFocusTest.java line 91:

> 89:             JScrollPane scrollPane = (JScrollPane) popup.getAccessibleContext().getAccessibleChild(0);
> 90:             JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
> 91:             return scrollBar.getValue();

Similar code duplication at L113 - L114. Can be pushed to a helper method.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23451#discussion_r1961020404
PR Review Comment: https://git.openjdk.org/jdk/pull/23451#discussion_r1961020200
PR Review Comment: https://git.openjdk.org/jdk/pull/23451#discussion_r1961027933


More information about the client-libs-dev mailing list