Click to See Complete Forum and Search --> : problem Jlist & addElement


Jiang Pet
February 22nd, 1999, 04:21 AM
I tried to make add/remove items in a JList after the JList object constructed,

so i use DefaultListModel in my code, like beneath:



........

DefaultListModel newListModel = new DefaultListModel();

for(int i =0;i<sum;i++) {

newListModel.addElement(String demoString);

System.out.println(i);

}

list.setModel(newListModel);

........


but when the items is more than 500 it became very very slowly.


I'll appreciate if any body can give me the idea, how to overcome the

problem.


thanks


Jiang Pet