static JPanel smartAddWithLayout(JPanel panel, O layout, 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, layout); } ret panel; } static JPanel smartAddWithLayout(JPanel panel, O layout, O... parts) { ret smartAddWithLayout(panel, layout, asList(parts)); }