// x = names and components interleaving. // or just components. // or just names. // also, you can pass a Collection containing the elements svoid addTabs(JTabbedPane tabs, O... x) { if (tabs == null) ret; x = flattenToArray(x); for i over x: { // is it a component? O o = x[i]; if (isComponentOrSwingable(o)) addTab(tabs, "Tab " + (tabCount(tabs)+1), wrap(o)); else { // assume it's a tab name, optionally followed by a component S toolTip = ""; // WithToolTip is ok (WithToolTip not yet supported) if (o cast WithToolTip) { toolTip = o.toolTip(); o = o!; } S name = str(or(o, "Tab " + tabCount(tabs)+1)); Component c; if (isComponentOrSwingable(get(x, i+1))) c = wrap(get(x, ++i)); else c = new JPanel; addTabWithToolTip(tabs, name, toolTip, wrap(c)); } } }