aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to generate Action on JComboBox click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to generate Action on JComboBox click" Watch "How to generate Action on JComboBox click" New topic
Author

How to generate Action on JComboBox click

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
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.


kunal
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
Thanks for your reply Michael Dunn. Will try to implement this today
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to generate Action on JComboBox click