John Duke wrote:When I create the DefaultComboBoxModel, I give it a static Vector of Strings.
luck, db
There are no new questions, but there may be new answers.
luck, db
There are no new questions, but there may be new answers.
luck, db
There are no new questions, but there may be new answers.
John Duke wrote:I needed to 'share' the model, not just the list data. Somehow, I got it into my head that the models were the view of the data, so I thought I needed each combobox to have its own model. After makng the model static, I got the notifications I needed.
Oops. I spoke too soon. Sharing the model did what I thought it would: the same selection appears in all of the comboboxes.
Brian Cole wrote:Darryl Burke has the right approach, but his code needs to also override getSelectedItem()/setSelectedItem() or else they will attempt to refer DefaultComboBoxModel's internal Vector.
luck, db
There are no new questions, but there may be new answers.
Darryl Burke wrote:
Um, no, they don't. DefaultComboBoxModel has a field selectedItem which is independent of the data vector.