こんにちは、私はまだ Java の初心者です。この素晴らしい機能を学びたいと思っています... こんにちは、同じ内部と内部を持つ 4 つのコンボ ボックスがあります。
-Select-
Item 1
Item 2
Item 3
Item 4
Item 1
onを選択するcomboBox1
と、comboBox2,comboBox3 and comboBox4
これらの要素のみが含まれます
-Select-
Item 2
Item 3
Item 4
そして、Item 3
onを選択するcomboBox2
と、comboBox3 and comboBox4
この残りの要素があります
-Select-
Item 2
Item 4
Javaでこれを行う方法を知っている人はいますか? Netbeans で GUI ビルダーを使用しています...
編集1
これは私のコードです
private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {
jComboBox2.removeItem(jComboBox1.getSelectedItem());
jComboBox3.removeItem(jComboBox1.getSelectedItem());
jComboBox4.removeItem(jComboBox1.getSelectedItem());
}
その後、同じコードを追加しjComboBox2, jComboBox3 and jComboBox4
ます...私が行くときは-Select-
、-Select-
あまりにも消えています...そして
もう1つの問題は、すでにすべてを選択していて、もう一度交換しようと考えているときです...すべてのアイテムがなくなり、もう選択肢がありません..利用可能なアイテムをもう一度元に戻したいだけです...
編集2
例
jComboBox1
-Select-
Item 1
Item 2 <-- I select Item2, then the other combo box will remove Item 2**
Item 3
Item 4
jComboBox2
-Select-
Item 1
Item 3 <-- then I select Item 3
Item 4
jComboBox3
-Select-
Item 1
Item 4 <-- then Item 4
jComboBox4
-Select-
Item 1
しかし、私は気が変わっています...そして、選択するために戻る必要がある jComboBox2
ので、選択してItem3
選択
jComboBox2
し、選択できる-Select-
ようにしますitem3
jComboBox4
しかし、結果は jComboBox4 null (アイテムなし) です