--- a/jdk/src/share/classes/javax/swing/JComboBox.java Mon May 26 16:37:25 2014 +0400
+++ b/jdk/src/share/classes/javax/swing/JComboBox.java Mon May 26 18:01:59 2014 +0400
@@ -1308,13 +1308,15 @@
* do not call or override.
*/
public void actionPerformed(ActionEvent e) {
- Object newItem = getEditor().getItem();
- setPopupVisible(false);
- getModel().setSelectedItem(newItem);
- String oldCommand = getActionCommand();
- setActionCommand("comboBoxEdited");
- fireActionEvent();
- setActionCommand(oldCommand);
+ ComboBoxEditor editor = getEditor();
+ if ((editor != null) && (e != null) && (editor == e.getSource())) {
+ setPopupVisible(false);
+ getModel().setSelectedItem(editor.getItem());
+ String oldCommand = getActionCommand();
+ setActionCommand("comboBoxEdited");
+ fireActionEvent();
+ setActionCommand(oldCommand);
+ }
}
/**