Hi folks,

I'm writing some utility classes for a project, and I've written an abstract class called "XPObjectTable" that displays a table of objects of a given type. To refresh this, I'm using "AbstractTableModel.fireTableDataChanged()". Now I'm writing a similar class for JList, but can't find a similar method (i.e. "AbstractListModel.fireListDataChanged()"). Please could somebody either post a snippet of code that will do the equivilent, or please provide a hint as to how such a method could be created.

Thanks, Lee.

P.S. In order to make this class as easy-to-use as possible, I need a method that takes no parameters; it should simply refresh the entire list.

Take a look at this section on using JList with a mutable model:

I've used mutable list models quite a lot in the past, but in this case it won't work as easily as that. The XPObjectList<T> class provides the following abstract methods in order to get the objects to go into the list...

abstract T[] getObjects()
abstract int getObjectCount()

What I need to do is basically call these 2 methods to refresh the list contents when I call the updateData() method. Then again, I suppose I could actually clear a mutable list model and repopulate it with the data from getObjects()?

Or just create your own small wrapper model.