RFR: 4459231: Focus of JTabbedPane(with Scrollable tablayout) changes on change in LookAndFeel [v2]

Alexander Zuev kizune at openjdk.org
Wed Dec 3 21:40:38 UTC 2025


On Mon, 1 Dec 2025 09:46:35 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> On changing LookAndFeel of JTabbedPane, it resets the focus of the child tabs to starting child tab.
>> That is, if a JTabbedPane has say 10 tabs and we select the 10th tab and then we change the L&F, the focus is shifted to Tab0 even though the selected tab is still at 10th tab.
>> 
>> This is because when we switch L&F, `installUI ` will reset the `focusIndex ` 
>> https://github.com/openjdk/jdk/blob/3481252ced7c06c44154ceccc56b12cfd9a490c3/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java#L285-L290
>> 
>> which needs to set the proper focus by calling `scrollRectToVisible ` to selected tab which is done in this fix.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   test fix

Looks good.

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

Marked as reviewed by kizune (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28571#pullrequestreview-3537030091


More information about the client-libs-dev mailing list