// x = names and components interleaving. // or just components. // or just names. // also, first element can be index of tab to open at start // also, SUPER short demo syntax: jtabs(3) static JTabbedPane jtabs(O... x) { int idx = 0; if (get(x, 0) instanceof Int) { idx = asInt(get(x, 0)); x = dropFirst(x); if (empty(x)) { x = arrayrep(null, idx); idx = 0; } } new JTabbedPane tabs; int n = 0; for (int i = 0; i < l(x); i++) { ++n; if (x[i] instanceof Component) tabs.addTab("Tab " + n, wrap((Component) x[i])); else { S name = str(or(x[i], "Tab " + n)); Component c; if (get(x, i+1) instanceof Component) c = (Component) get(x, ++i); else c = new JPanel; tabs.addTab(name, wrap(c)); } } if (idx != 0) tabs.setSelectedIndex(max(tabs.getTabCount()-1, idx)); ret tabs; } static JTabbedPane jtabs(Collection c) { ret jtabs(toObjectArray(c)); }