This discussion is archived
1 Reply Latest reply: Feb 7, 2010 11:04 PM by 843807 RSS

How do I properly bind and observe a List?

843807 Newbie
Currently Being Moderated
I'm trying to bind a List to JList, but I'm having problems figuring out how to add or remove items from either object as the other object doesn't seem to update.

Here is what I've bound to JList to:
public class ExportInfo {
public List getMyList() {
    return this.myList();
Here is the binding:
ELProperty eLProperty = ELProperty.create("${myList}");
JListBinding jListBinding = SwingBindings.createJListBinding(AutoBinding.UpdateStrategy.READ_WRITE, exportInfo, eLProperty, myList);
Now if I remove object from the List myList, the JList does not update immediately. I know I have to do something with the observer pattern, I'm just not sure how to implement it. Thanks to anyone who helps! :)