Maybe I didn't explain the situation good enough. Here goes round two. I have a vector which feeds a JList. Each item is a String and I allow the JList to have multiple selections. I have a delete button which gets the selection indices and then attempts to delete the selected items from the vector. Problem is that it will always get an ArrayOutOfBoundsException when doing multiple removes. Can somebody please look at this code and see if you can help me delete multiple selections from my JList. Thank you. CODE BELOW:
[ October 12, 2002: Message edited by: Frank Hale ]
Hi Frank, I think, the problem is the way, haw you delete the entries in your data vector. If you remove multiple elements from it, then you may run in problems if you start from the beginning. In your case, you should start at the end.
Imagine a vector with 3 elements, where you want to delete the first and the last. In your case, you start with the first, this goes well, but when you want to delete the last, the index of the last has already changed, so you will delete an element, which doesn't exist. This is the reason for your exception. Hope that helps
Joined: Mar 25, 2000
Rene, Thank you for the help. This works great!!! Thanks a million.... Frank