Hi ULC-Developers,
I' ve got a problem when updating a ComboBox:
if (cbxModel == null)
cbxModel = new MyMapCbxModel(myMap);
boxPane.getComboBox().setModel(cbxModel);
boxPane.getComboBox().setSelectedItem(myMap.get(key)));
When opening a dialog with this boxpane it is initialize with the
selected item of the map.
But when I update the dialog and the selected item changes the
combobox content does not change!
Is there a solution?
Here is my Model:
abstract public classMyMapCbxModel implements IComboBoxModel {
protected Map m_map = null;
private Object m_selected = null;
public DefaultMapCbxModel(Map map) {
this.m_map = map;
}
public Object getSelectedItem() {
return m_selected;
}
public void setSelectedItem(Object item) {
m_selected = item;
}
public int getSize() {
return this.m_map.size();
}
public void addListDataListener(IListDataListener listener)
{
}
public void removeListDataListener(IListDataListener
listener) {
}
/**
* Return the key
* @param index
* @return
*/
public Integer getKeyAt(int index) {
Object key = null;
Integer result = new Integer(0);
try {
key = this.m_map.keySet().toArray()[index];
} catch (Exception e) {
return result;
}
if (null != key)
return (Integer) key;
return result;
}
public Object getElementAt(int index) {
Object key = this.m_map.keySet().toArray()[index];
if (null != key)
return this.m_map.get(key);
return null;
}
}
Mit freundlichen Grüßen/ Best Regards/Sincères Salutations
Ralph Weyers
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer