On Mon, 1 Dec 2025 08:55:28 GMT, Prasanta Sadhukhan <[email protected]> 
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.

This pull request has now been integrated.

Changeset: 1f49edd9
Author:    Prasanta Sadhukhan <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/1f49edd9783ed4579d989d6939ee75e926f0716a
Stats:     120 lines in 2 files changed: 120 ins; 0 del; 0 mod

4459231: Focus of JTabbedPane(with Scrollable tablayout) changes on change in 
LookAndFeel

Reviewed-by: tr, kizune

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

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

Reply via email to