I want to transfer the selected objects from one JList to another JList, say List1 and List2.
try something like this. it will work fine
DefaultListModel dlm = new DefaultListModel();
jButtonActionPerformed {
jList2.setModel(dlm);
jList1.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
for (Iterator it = jList1.getSelectedValuesList().iterator(); it.hasNext();) {
String sel = (String) it.next();
if (dlm.contains(sel)) {
} else {
dlm.addElement(sel);
}
}
}