static A tabComponentClickFixer(A c) { onMouseDown(c, e -> { JTabbedPane tabs = parentOfType(c, JTabbedPane.class); if (tabs == null) ret; var tabComponents = tabComponents(tabs); print ifdef tabComponentClickFixer_debug("Looking for tab for " + c); for i over tabComponents: if (isGrandChildOf(c, tabComponents.get(i))) { print ifdef tabComponentClickFixer_debug("Found tab: " + i); ret with selectTab(tabs, i); } }); ret c; }