Java Swing Combobox removeAllItems calling ItemStateChanged also?

后端 未结 5 1698
无人及你
无人及你 2021-01-15 06:24

My code is quite simple actually. I saw a simple and similar code was from this article.

At first, I have 1 combobox. I have a listener on it called

5条回答
  •  旧巷少年郎
    2021-01-15 06:48

    One quick way to do is to have a bool set to true before you call removeAllItem() and back false after. Execute the code in your itemStateChanged() only if the bool variable is false.

    Ideally you could override the removeAllItem() function.

提交回复
热议问题