Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

combobox selection  RSS feed

 
Arun Sanker
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Iam new to Listeners under Swing.Is working on a task under swing & came across the following problem.

Have a comboBox(Say testCombo) filled with some string values.When the user selects one item from thge popup menu or when he presses "Enter" I want to do some action.

Tried adding both the ItemListener & ActionListener to it,but then,

the events are generated even while the user is moving through items in the displayed popup menu or when I add I add some items in the combobox.Thats not what I want..

I want to do some action only when the user selects an item from the comboxbox.(Iam coming from the MFC world.In MFC, could achieve it on a comboclose up event )

How can I achieve this under swing...

Thanks..
 
Brian Cole
Author
Ranch Hand
Posts: 935
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kohinoor:
Tried adding both the ItemListener & ActionListener to it,but then,

the events are generated even while the user is moving through items


It sounds like you want the ActionListener but not the ItemListener.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!