我的代碼數組。如何在數組中插入項目?如何在數組中插入項目?
int listElemCount = jCBWorkerMen.getItemCount();
Object[] selectionValues = null;
for (int i = 0; i < listElemCount; i++) {
selectionValues[i] = (Object[]) jCBWorkerMen.getItemAt(i);
System.out.println(selectionValues);
}
String initialSelection = "Dogs";
Object selection = JOptionPane.showInputDialog(null, "What are your favorite animals?", "Zoo Quiz", JOptionPane.QUESTION_MESSAGE, null, selectionValues, initialSelection);
System.out.println(selection);
使用'List',如'ArrayList',假設你的意思是你想改變數組的長度.. – MadProgrammer 2014-09-01 05:15:05
如果你想插入(添加,改變長度等)數組,請使用'List',參見http://stackoverflow.com/questions/2697182/how-to-use-an-array -list –
jdphenix
2014-09-01 05:17:27
另外,「jCBWorkerMen」的類型是什麼? – jdphenix 2014-09-01 05:18:58