-1

I have three JComboBoxes; and based on the 1st and 2nd JComboBoxes, the 3rd JComboBox should
show different values. I was able to get the values on the 3rd JComboBox, but for some reason it appends the values with the previous selection. For example,

JCombo1 - A, B, C, D, E, F
JCombo2 - A1, A2, A3, A4, A5
JCombo3 - AA1, AA2, AA3, AA4, AA5

Please help.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
user1815823
  • 617
  • 2
  • 8
  • 14

1 Answers1

1

From my understanding this you asked for append JComboBox1,jComboBox2 (up to item available in jCombo2).

 private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
    this.jComboBox3.removeAllItems();
    String boxOneValue = jComboBox1.getSelectedItem().toString();
    for(int i = 0; i < jComboBox2.getItemCount(); i++) {
        jComboBox3.addItem(boxOneValue + jComboBox2.getItemAt(i));
    }
}
Dhinakar
  • 4,061
  • 6
  • 36
  • 68