Whenever a item is selected from JComboBox, the itemListener method is called twice..... !!???
Why is it happening, i need this method to be called only once with the current selected item. But its calling this method with both, current and previous selected item...
The behavior of ItemListener is like that only. It will call itemStateChanged two times because, one of the item lost focus, another one gains focus. so it will call two times.
My suggestion is use ActionListener , and write actionPerformed like this
The behavior of ItemListener is like that only.
It will call itemStateChanged two times because,
one of the item lost focus,
another one gains focus.
so it will call two times.
My suggestion is use ActionListener , and write actionPerformed like this
Hope This Helps.
All The Best
i tried to setFocusable(false) and it works just fine.