Removing all Items from a combo box in Java

前端 未结 9 1198
自闭症患者
自闭症患者 2021-02-06 11:04

I need to remove all items from the combo box

    int itemCount = combo.getItemCount();

    for(int i=0;i

        
9条回答
  •  终归单人心
    2021-02-06 11:36

    The code in the question would normally work. However, it looks like a threading issue. Another thread may be messing with the items.

    However, I sugeest you should better use the removeAllItems(); method:

    combo.removeAllItems();
    

提交回复
热议问题