• Post Reply Bookmark Topic Watch Topic
  • New Topic

please help me on combobox problem. Thanks :)  RSS feed

 
marshal ma
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am new to Java, also new to GUI. Hope to get help from you.

I am doing a GUI design, one part of it containing two combobox and one textfield which I want them have the following function:

Assume comboboxA (include 1,2,3,4) and comboboxB(include a,b,c,d,e,f) and textfield(has many string groups corrsponding to each item in comboboxB )

At default setting, comboboxA has drop down list including 1,2,3,4. while comboboxB and textfield are empty. When I select 1 from drop down list of combobox A, I want comboboxB automatically has a,b,c in box for selection. When I select "a " in comboboxB, the textfield automatically has a group (corresponding to "a") for selection. My final purpose is to select an item in textfield to do some action.

If possible please tell me how to implement. I studied tutorial of combobox of sun for a whole day but still can't get it (don't have such complicated example in tutorial and don't have more time to learn it).

Really appreciate your help!!!

Thank you very much!!!

marshal
 
Anthony Yip
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add ItemListener to ComboBoxA to update the ComboBoxModel of ComboBox B according to ComboBoxA's selection. Then do the same to ComboBoxB to update the textfield.

Regards
Anthony Yip
 
marshal ma
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your help Anthony Yip !!!

Best Regards

marshal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!