Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ArrayIndexOutOfBoundsException - JList

843807Dec 29 2009 — edited Dec 29 2009
Hello,
I have populated myList.list which is simply ArrayList<MyFile>
When i run this code:
DefaultListModel listModel = new DefaultListModel();
        for(int i = 0; i < myList.list.size(); i++)
        {
            listModel.addElement(myList.list.get(i));
        }
        lstFilesList.setModel(listModel);
at first time everything is ok, JList is populated, at second time also unless i check some row on this JList.
If I do so, i get ArrayIndexOutOfBoundsException..
(it's thrown by lstFilesList.setModel(listModel); line)
this Ive been looking for the answer, but didnt get any result;/
do you know why does it happen?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2010
Added on Dec 29 2009
3 comments
76 views