posted 22 years ago
Rene's method works...but there's another way that might involve less overhead if you have a lot of insertions/deletions occuring in the JList data.
The JList's list model is a DefaultListModel. So, you could do something like the following.
DefaultListModel model = (DefaultListModel) myList.getModel();
model.addElement(myObject);
I can't remember off the top of my head if this fires an event for the JList to redraw itself or not. If not, a simple call to the JList's repaint method should probably suffice.
[ July 22, 2002: Message edited by: Shane Kirk ]