how to store selection actions of multiple comboBox in to Array
My array only store user's last comboBox action which is really weird.
Who could give some suggestion pls?
for (int j=0;j<i;j++){
Object index = comboBox[j].getSelectedItem();
checkList[j]=(String) index;
System.out.println("test "+(j+1)+" "+checkList[j]);
}
checkList[0]= (String) comboBox[0].getSelectedItem();
Besides anyone know how to make comboboxes within one column show different options?
try{
String thisLine;
ArrayList><String> arrayList=new ArrayList<String>();
FileReader fr=new FileReader(file);
BufferedReader br =new BufferedReader(fr);
i = 0;
while ((thisLine = br.readLine()) !=null){// while loop begins here
// split row and add it to table
arrayList.add(thisLine);
String row [] =null;
row = thisLine.split(";");
dtm.addRow(row);
answerList[i]=row[3];
//render collumns
TableColumn col = table.getColumnModel().getColumn(0);
col.getCellRenderer();
//Split answer options
TableColumn answer = table.getColumnModel().getColumn(1);
String temp [] =null;
temp = row[1].split("/");
//add options to ComboBox
comboBox[i]=new JComboBox();
comboBox[i].addItem(temp[0]);
comboBox[i].addItem(temp[1]);
comboBox[i].addItem(temp[2]);
answer.setCellEditor(new DefaultCellEditor(comboBox[i]));
//comboBox[i].addActionListener(new ComboBoxListener());
i++;
System.out.println("Q"+i+" Correct Answer: "+row[3]);
}
br.close();
}
catch (IOException e1){
System.err.println("Error: " + e1);
}...
Message was edited by:
karen577

