Jlist validate
Hi friends
I am trying to transfer the data between multiple JList.
this is what my code looks like
initialization
int selectedIndex[] = null;
DefaultListModel dlmAddressAll;
JList jltAddressAll
--
if(event.getSource() == sbtnDeselectCC) {
selectedIndex = jltAddressCC.getSelectedIndices();
for(int i = 0; i < selectedIndex.length ; i++ ) {
dlmAddressAll.addElement(dlmAddressCC.get(selectedIndex));
}
jltAddressCC.validate();
for(int i = 0 ; i < selectedIndex.length ; i++) {
dlmAddressCC.remove(selectedIndex);
}
i am using JDK 1.6
i am facing some problems regarding this function
ListSelectionModel is MULTIPLE_INTERVAL_SELECTION.
1.When i select all the rows from the list and then transfer to another List, they get added in target list but while removing from the original list only half of the rows are removed.
2.Many times i face ArrayIndexOutOfBound exception when while removing the elements equal to size of list.
Also after we add any element to a list model we perform validate method on list . But is it right to call that method on the list from which elements are removed.
If any one know the solution .
Thanks
--Sunny Jain
null

