• Post Reply Bookmark Topic Watch Topic
  • New Topic

combobox selection

 
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: 920
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!