Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to cater for both ItemListener and FocusListener for a JComboBox

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, in the SSCCE, the ItemListener is not triggered when I
add a FocusListener for it beforehand.
How can I make them both function when either focus is lost or
when an item is selected?

 
Saloon Keeper
Posts: 12269
259
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This works perfectly for me:
Start eliminating stuff from your "SSCCE" until you find which part is the culprit.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stephan,
Your code works really well.
I'll try to dig out the parts tomorrow.
Jack
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello back in again.
When I have just one item, I click on that item.
ItemStateChanged isn't triggered.
How can I make ItemStateChanged to be triggered even though there is
just one item in the JComboBox?
Thanks
Jack
 
Rancher
Posts: 3205
29
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How can I make ItemStateChanged to be triggered even though there is
just one item in the JComboBox?



Post your SSCCE!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic