> In a JComboBox, if the user opens the dropdown list and clicks and holds the 
> down-button, then ALT-TABs to switch focus, when the user re-focuses the 
> frame with the JComboBox and opens the dropdown list again, the list will 
> still be scrolling even though the down-button isn't pressed.
> 
> This isn't OS or L&F specific, although Aqua L&F does not have any 
> directional arrows in the dropdown list (and is thus exempt). This led me to 
> believe it could be handled in BasicComboBoxUI where focusLost and focusGain 
> are used or isPopupVisible but the scroll behavior cannot be altered here. 
> Likewise for BasicComboPopup where `autoscroll` is used. However, this 
> behavior isn't related to autoscroll and is actually found in the JScrollbar 
> of the JScrollpane inside of the JComboBox. The timer for the scroll action 
> starts but is never stopped if focus is lost, so a new listener is created 
> and used. The proposed solution uses `KeyboardFocusManager` to track the 
> focus owner. The listener stops the `scrollTimer` when the `focusOwner` 
> property is changed. With this change, the list no longer automatically 
> scrolls when re-focused and instead opens normally.
> 
> The included test is manual due to the need to confirm that the list still 
> scrolls after ALT-TABing. The L&F is set to Metal since it is the 
> cross-platform lookandfeel and has directional buttons for the JScrollPane 
> list.

Damon Nguyen has updated the pull request with a new target base due to a merge 
or a rebase. The incremental webrev excludes the unrelated changes brought in 
by the merge/rebase. The pull request contains five additional commits since 
the last revision:

 - Update fix to resolve button pressed appearance. Handle review comments
 - Merge branch 'master' into 6672644/focusScroll
 - Initial commit
 - Review comments
 - Initial commit

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20845/files
  - new: https://git.openjdk.org/jdk/pull/20845/files/312c484d..2dbba1ae

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20845&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20845&range=01-02

  Stats: 269780 lines in 2960 files changed: 230777 ins; 22759 del; 16244 mod
  Patch: https://git.openjdk.org/jdk/pull/20845.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20845/head:pull/20845

PR: https://git.openjdk.org/jdk/pull/20845

Reply via email to