我的代码数组。如何在数组中插入项目?如何在数组中插入项目?
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