How can I refresh the contents of a JList??

Jesper Berglund

When you have added or removed an item from the ListModel you can call

fireContentsChanged(Object source, int index0, int index1)

For example:

...
  DefaultListModel model = (DefaultListModel)aJList.getModel();
  model.removeElementAt(anIndex);
  model.fireIntervalRemoved(model, anIndex, anIndex);
...
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact