清除Java中的下拉计数器?
我需要清除几个数组中的所有字段,以重新加载要解析的新模板。我目前设置了一个清除所有相关数组列表和计数的函数。除了我在clearMicroArray()函数中很难清除obrDD之外,这些都工作得很好。 这是我当前的代码(没有清除obrDD的逻辑)。如何清除函数中的下拉信息清除Java中的下拉计数器?,java,removeall,Java,Removeall,我需要清除几个数组中的所有字段,以重新加载要解析的新模板。我目前设置了一个清除所有相关数组列表和计数的函数。除了我在clearMicroArray()函数中很难清除obrDD之外,这些都工作得很好。 这是我当前的代码(没有清除obrDD的逻辑)。如何清除函数中的下拉信息 static void clearMicroArray() { fullMicroArray.clear(); int returnSize = fullMicroArray.size(); Sy
static void clearMicroArray() {
fullMicroArray.clear();
int returnSize = fullMicroArray.size();
System.out.println("size of full array" + returnSize);
obrCount = 0;
fileRowCount = 0;
// obr List
obrList.removeAll(obrList);
obxList.removeAll(obxList);
};
// Populating the OBR number in dropdown
public static void populateOBRDropdown(JComboBox<String> obrDD) {
for (int i = 0; i < fullMicroArray.size(); i++) {
if (fullMicroArray.get(i).substring(0, fullMicroArray.get(i).indexOf("|")).equals("OBR")) {
i++;
obrCount++;
obrDD.addItem("OBR " + obrCount);
}
}
}
static void clearMicroArray(){
fullMicroArray.clear();
int returnSize=fullMicroArray.size();
System.out.println(“完整数组的大小”+返回大小);
对象计数=0;
fileRowCount=0;
//obr列表
移除所有(obrList);
removeAll(obxList);
};
//在下拉列表中填充OBR编号
公共静态void populateOBRDropdown(JComboBox obrDD){
对于(int i=0;i
obrDD是一个JComboBox对象,您可以将它传递到populateOBRDROPPOWN中。然而,您的clearMicroArray方法也需要obrDD作为输入,以便您使用它做任何事情。传递对JComboBox的引用后,您可以从clearMicroArray调用removeAllItems或removeItem。传入要清除的数组?您认为有没有其他方法可以清除PopulateObjDropDown()?您需要不同的部分?为什么?