// Note: There seems to be some extra space below the tabs // when using JTattoo. FlatLAF works fine. // TODO: changing tabs at runtime, event handling etc. sclass JExtendedTabbedPane is Swingable { JTabbedPane tabs; new L components; SingleComponentPanel scpBesideTabs = scp(); SingleComponentPanel scpPage = scp(); *(JTabbedPane _tabs) swing { tabs = _tabs != null ? _tabs : jtabs(); int n = tabCount(tabs); for i to n: { components.add(tabs.getComponentAt(i)); tabs.setComponentAt(i, emptyPage()); } onTabSelectedAndNow(tabs, l0 updatePage); } void updatePage { scpPage.set(get(components, getSelectedIndex())); } // Something with minimum size 0 Component emptyPage() { ret verticalStrut(0); } cachedVisual northAndCenter(centerAndEastWithMargin( tabs, scpBesideTabs), scpPage); selfType setComponentBesideTabs(Component c) { scpBesideTabs.set(c); this; } int getSelectedIndex() { ret tabs.getSelectedIndex(); } void setComponentAt(int i, Component c) { components.set(i, c); if (getSelectedIndex() == i) updatePage(); } void add(S title, Component c) { components.add(c); tabs.add(title, emptyPage()); } int getTabCount() { ret tabs.getTabCount(); } void setTitleAt(int i, S title) { tabs.setTitleAt(i, title); } void setSelectedIndex(int i) { tabs.setSelectedIndex(i); } }