新手問題:
所以這里的代碼
public void comboItemItemStateChanged(java.awt.event.ItemEvent evt) {
ArrayList<String> arrayItem = new ArrayList<>();
Iterator<String> iter;
if(comboGroup.getSelectedItem().equals("Betta Fish")){
comboItem.removeAllItems();
arrayItem.add("Plakat");
arrayItem.add("Halfmoon");
arrayItem.add("Crown Tail");
arrayItem.add("Double Tail");
iter = arrayItem.iterator();
while(iter.hasNext()){
comboItem.addItem(iter.next());
}
}
else if(comboGroup.getSelectedItem().equals("Snails")){
comboItem.removeAllItems();
arrayItem.add("Apple Horn");
arrayItem.add("RamsHorn");
arrayItem.add("Pond Snail");
arrayItem.add("Assassin Snail");
iter = arrayItem.iterator();
while(iter.hasNext()){
comboItem.addItem(iter.next());
}
當我Design在 NetBeans 中的選項卡上嘗試組合框時作業。但是當我嘗試將它應用到我的編碼 ComboBox 時,我收到一條訊息,evt說Unused method parameters should be removed. 我可以解釋一下為什么以及硬編碼的替代方法是comboBox什么?
代碼的目的:一個動態的comboBox,所以我選擇的任何東西comboBox1都會有自己的一組串列comboBox2
注意:我也嘗試更改comboItemItemStateChanged為 just itemStatChanged。
我的專案源代碼:
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/429906.html
