static JPanel smartAdd(JPanel panel, L parts) { for (O o : parts) { Component c; if (o == null) c = new JPanel; else if (o instanceof S) c = jlabel((S) o); else c = wrap(o); panel.add(c); } ret panel; } static JPanel smartAdd(JPanel panel, O... parts) { ret smartAdd(panel, asList(parts)); }