• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to cater for both ItemListener and FocusListener for a JComboBox

 
Jacky Luk
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?

 
Stephan van Hulst
Bartender
Posts: 6583
84
  • 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
 
Rob Camick
Ranch Hand
Posts: 2700
10
  • 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!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!