I have this JList (say MyList) in a JFrame. I am using Netbeans6 GUI builder and I have set the binding for this list.
At startup, the binding works fine, and MyList populates correctly.
Now what I'm looking for is a way to add more data to this list from another text box when I click a button. But the problem exists here:
Binding w / o I would retrieve the ListModel for the JList using the function "getModel ()" and add an element to it using "addElement ()".
However, when im uses binding. and I try to extract the ListModel and map it to DefaultListModel, I get the following exception:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.jdesktop.swingbinding.JListBinding$BindingListModel cannot be cast to javax.swing.DefaultListModel
So my question is: how to add more elements to MyList that are already bound to another data source?
Does anyone have any clues? Any help would be greatly appreciated!
Thanks!
source
share