// 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) null; O[] x = flattenToArray(x); int n = 0; for (int i = 0; i < l(x); i++) { ++n; // is it a component? O o = x[i]; if (isComponentOrSwingable(o)) addTab(tabs, "Tab " + n, 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 " + n)); Component c; if (isComponentOrSwingable(get(x, i+1))) c = wrap(get(x, ++i)); else c = new JPanel; addTabWithToolTip(tabs, name, toolTip, wrap(c)); } } }