I think you are trying to delete a object in JComboBox.
You deleting command is fine. But there is a problem.
After you have deleted a object in JComboBox, the selected item is changing implicitly. That's because JComboBox cannot find that previously selected item as it has been deleted. Therefore JComboBox select the previous item.
But you have override itemStateChanged() method. As the previously selected item is deselected and new item is selected, overridden method is called twice. (But it is not the problem here)
Here the variable 'selected' is the problem. If you select 2nd item selected=1. After you delete 2nd item, JVM calls itemStateChanged() method. Then comboBox.getItemAt(selected) will give runtime error as 'selected = 1'.