So, here's the problem: I need 3 or more jComboBoxes (all with same items) to be connected to one another so that when I select one item in any jComboBox, that item will disappear in all other jComboBoxes. Concrete example: Poker game is over. Now I need to save the players places. I have jComboBoxes (which represent places) populated with profiles of players and I want to make sure only one profile can be selected throughout jComboBoxes. I tried something on my own and gotten this far. As you will see, it's totally useless...
in MyItemListener:
if (jComboBox1 == evt.getSource())
{
if (jComboBox1.getSelectedIndex() > 0)
{
jComboBox2.removeItem(jComboBox1.getSelectedItem());
jComboBox3.removeItem(jComboBox1.getSelectedItem());
}
}
if (jComboBox2== evt.getSource())
{
if (jComboBox2.getSelectedIndex() > 0)
{
jComboBox1.removeItem(jComboBox2.getSelectedItem());
jComboBox3.removeItem(jComboBox2.getSelectedItem());
}
}
if (jComboBox3== evt.getSource())
{
if (jComboBox3.getSelectedIndex() > 0)
{
jComboBox1.removeItem(jComboBox3.getSelectedItem());
jComboBox2.removeItem(jComboBox3.getSelectedItem());
}
}