0

I have created two select list (Combo box). BankName and BranchName.
BankName is using LOV with query to display bankname.
This is working fine.
Now when i select Bank name i want to display selected branches of that bank in Branchname combo.How to display values in second combo basis on first combo value click.It should refresh after click
Please reply

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by hanvyj
0

add ActionListener to jcbBankName
inside ActionPerformed method:
- check jcbBankName.getSelectedItem()
- force new model - jcbBranchName.setModel(...your model..relate to checked value)

in the constructor of your class, do not forget to set default values for both the comboboxes

Edited by quuba: add last line

0

i have this code will u plz help me

String obj =(String)jComboBox1.getSelectedItem();

System.out.println(obj);

res=stat.executeQuery("Select flight from main where Route= '"+obj+"' ");
String [] array2=new String[5];

for(int i=0;res.next();i++)
array2=res.getString(2);

jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(array2));

0

where is this code? whats wrong with it, ie how can we "help"? is it in an actionListener???

oh, and please use code tags

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.