Deselected item in ItemListener.itemStateChanged()
When I listens a combobox with ItemListener how can I know, what item w开发者_开发知识库as deselected when ItemEvent.DESELECTED is fired?
Use ItemEvent.getItem()
You cannot directly get the item index. The workaround is to get the deselected item from ItemEvent.getItem()
and find the index by iterating over all items.
精彩评论