< prev index next >
src/share/classes/javax/swing/JComboBox.java
Print this page
rev 14331 : 8072767: DefaultCellEditor for comboBox creates ActionEvent with wrong source object
Reviewed-by: serb, azvegint
*** 566,575 ****
--- 566,577 ----
}
}
if (!found) {
return;
}
+
+ getEditor().setItem(anObject);
}
// Must toggle the state of this flag since this method
// call may result in ListDataEvents being fired.
selectingItem = true;
*** 1305,1325 ****
/**
* This method is public as an implementation side effect.
* do not call or override.
*/
public void actionPerformed(ActionEvent e) {
- ComboBoxEditor editor = getEditor();
- if ((editor != null) && (e != null) && (editor == e.getSource()
- || editor.getEditorComponent() == e.getSource())) {
setPopupVisible(false);
! getModel().setSelectedItem(editor.getItem());
String oldCommand = getActionCommand();
setActionCommand("comboBoxEdited");
fireActionEvent();
setActionCommand(oldCommand);
}
- }
/**
* This method is public as an implementation side effect.
* do not call or override.
*/
--- 1307,1323 ----
/**
* This method is public as an implementation side effect.
* do not call or override.
*/
public void actionPerformed(ActionEvent e) {
setPopupVisible(false);
! getModel().setSelectedItem(getEditor().getItem());
String oldCommand = getActionCommand();
setActionCommand("comboBoxEdited");
fireActionEvent();
setActionCommand(oldCommand);
}
/**
* This method is public as an implementation side effect.
* do not call or override.
*/
< prev index next >