dcsimg

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);
...