String () { List<Object> selection = comp.getSelectedValuesList(); JBIterable<Object> values; if (selection.size() > 1) { values = JBIterable.from(selection); } else { ListModel<Object> model = comp.getModel(); values = JBIterable.generate(0, o -> o + 1).take(model.getSize()).map(o -> model.getElementAt(o)); } ListCellRenderer<Object> renderer = comp.getCellRenderer(); StringBuilder sb = new StringBuilder(); for (Object value : values) { append(sb, value, renderer.getListCellRendererComponent(comp, value, -1, false, false)); sb.append("\n"); } return sb.toString(); }