Daniel Liu
Posts: 11
Nickname: hhliu
Registered: Feb, 2004
|
|
Delete items from an Icon and String JList
|
Posted: Feb 29, 2004 2:56 AM
|
|
Advertisement
|
Hello,
I need delete some items from an Icon and String JList.
Every time I select an item randomly from the list and then click a delete button, it goes to delete the last item of the list.
The following is the code segment I wrote:
personSelectedIndex = personList.getSelectedIndex();
personModel.removeElementAt(personSelectedIndex);
Also, I tried the following code: personValue = personList.getSelectedValue();
personModel.removeElement(personValue);
It works the same as the previous two lines.
Does any body know the reason?
Thanks,
Daniel
|
|