Brandon McCombs schrieb:
> Although what you say makes sense, I wonder if it's my problem because
> I'm modifying the model outside of the EDT (whatever that situation is
> properly termed) and after a few other method calls is when the model is
> updated with new nodes.
If you modfy the model outside of the EDT, then it's the problem. It's
easy. Really. Don't modify UI-state outside of the EDT and you don't get
strange Exceptions
I'll explain it in more detail, e. g. have a look at
> model.getListModel().remove(idx);
> /* reload the subtree and list to show deletion */
> refresh();
Since you're using DefaultListModel, the element at index idx gets
removed from DefaultListModel's data Vector. Then, the model's listeners
(to which the JList belongs, too) get notified. The JList repaints itself.
You call refresh afterwards. I expect, you set a new Vector on the
DefaultListModel. I expect that this occurs outside of the EDT, too.
Now, I can imagine two situations:
1) remove was called while repaint was active
2) refresh() modified the ListModel while repaint was active.
E. g. refresh could call DefaultListModel#removeAll.
>
> As you can see the removal from the list occurs before refresh().
Doesn't matter. The point is, that you modify UI-state outside of the
EDT. There are only a few methods in Swing (e. g. repaint()) that may be
used outside the EDT.
Bye
Michael