On Thu, 8 Sep 2022 09:46:03 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
> JTabbedPane throws NPE from its stateChanged listener as it tries to access
> uninstantiated TabbedPane.
> Fix is to use the tabPane passed to stateChangeListener so that correct
> tabPane is accessed.
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java
line 4102:
> 4100: setFocusIndex(tabPane.getSelectedIndex(), false);
> 4101:
> 4102: if (tabPane.getLayout() instanceof TabbedPaneScrollLayout) {
I see BasicTabbedPaneUI.tabPane object getting used in other listeners in this
Handler class. Is there a reason why only when we hit stateChanged() function
we are seeing NPE?
Is this NPE for tabPane object itself or Layout not being initialized?
-------------
PR: https://git.openjdk.org/jdk/pull/10216