Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to generate Action on JComboBox click

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 3 JComboBox in my form. I want that click on JComboBox should generate event, and not by on its own while the program executes.

I am using ActionListener. Inside the action performed method, i am using 4 ActionEvent object.getSource method, (1 for submit button and other 3 for combo boxes)




As soon as the program executes codes inside this runs and prints 'a','b','c'


I want that when user click comboxbox1, it should print only 'a', similarly 'b' for combobox2, and 'c' for combobox3.

I hope i am able to make the problem understand.

Actually on selection of combobox1, items for combobox2 is generated(from database), and on passing the value of selected item of combobox1 and combobox2 jointly, items for combobox3 is generated.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Michael Dunn. Will try to implement this today
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic