ListDataListener items removed

Wouldn't this class be much more useful if we could actually had access to the items removed and not just the indices?Does anyone know of a good method to listen for the items removed from a JList? (I am using a library that I have access to a JList component).
[276 byte] By [MisterFlibblea] at [2007-11-26 18:11:46]
# 1

> Wouldn't this class be much more useful if we could

> actually had access to the items removed and not

> just the indices?

Maybe for the simple cases...

> Does anyone know of a good method to listen for the

> items removed from a JList? (I am using a library

> that I have access to a JList component).

There's no good way to do this because the model determines when things are removed. For example, let's say the library you're using creates a model that is mapped onto a database column. If something in the database is removed, the model updates it's state as well. At that point, the model doesn't know what was there anymore so there's no way for you to know either.

That being said, if you can rely on the JList's model returning elements that you can interpret, you can keep your own model and listen to ListDataEvents like you have been doing. Update your local model as you see fit.

Jasprea at 2007-7-9 5:44:26 > top of Java-index,Desktop,Core GUI APIs...