1) Get the model for made_list
2) Get the selected items from orig_list
3) Make a new object[] that is the size of 1) + 2)
4) populate 3) with the items from 1) + 2)
5) set the make_list model with the object[] from 4)
구현 :
ListModel made_model = made_list.getModel(); // 1
Object[] orig_sel = orig_list.getSelectedItems(); // 2
Object[] new_made_model = new Object[made_model.size() + orig_sel.length]; // 3
// this block is 4
int i = 0;
for(;i < made_model.size(); i++)
new_made_model[i] = made_model.getElementAt(i);
for(; i < new_made_model.length; i++)
new_made_model[i] = orig_sel[i - made_model.size());
made_model.setListData(new_made_model); // 5
덕분에 .. 그 작업! – Deepak