我在刷新JTable
. 我从一个空的开始ArrayList
,在设置我选择的组合框后,我将内容加载到ArrayList
但JTable
不对其作出反应 - 它仍然是空的。有问题TableModel
吗?
这是我的代码...
public class ProjectTableModel extends AbstractTableModel{
private static final long serialVersionUID = 1L;
private static ArrayList<String> caseList = new ArrayList<String>();
@Override
public int getColumnCount() {
return 1;
}
@Override
public int getRowCount() {
return caseList.size();
}
@Override
public Object getValueAt( int row , int col) {
getRowCount();
switch(col){
case 0:
System.out.println("mam to");
return caseList.get(row);
}
return null;
}
public void setCaseList(String[] list){
for (int i =list.length - 1; i >= 0; i--) {
caseList.add(list[i]);
}
System.out.println(getRowCount());
fireTableDataChanged();
}
public String setValueAt(int row, int col){
return null;
}
public void addTestCase(String name) throws IOException{
File newDir = new File(TestCaseMaker.currentDir,
"Przypadek testowy"+(caseList.size()+1));
newDir.createNewFile();
caseList.add(name);
fireTableDataChanged();
}
public String getColumnName(int col) {
return "Przypadki testowe";
}
}