JComboBox.remove is not working

java, jcombobox, swing

Solution

There is no such method `remove` in `Class JComboBox`.

You want to use public void removeItemAt(int anIndex):

Removes the item at anIndex This method works only if the JComboBox uses a mutable data model.

jComboBox1.removeItemAt(jComboBox1.getSelectedIndex());

Problem

I am trying to remove selected items in the JComboBox (I have added design time) But remove function is not executed. What am I doing wrong ``` // jComboBox1.removeAllItems(); working // jComboBox1.removeItem(jComboBox1.getSelectedItem()); working jComboBox1.remove(jComboBox1.getSelectedIndex()); not working ```

Original source