私はjTableの実装と戦っています。独自の TableModel クラスを作成しました。そして問題があります。どういうわけか、私の tableData 配列 (Obejct[] の ArrayList) が正しく書き込まれていません。最後に、すべての行に値が含まれているテーブルを取得します。
ArrayList が正しく記述されていない理由は誰にも分かりますか?
class MyTableModel extends AbstractTableModel {
private String[] columnNames = {"Auftragsnummer",
"Kunde",
"Kunden Nr.",
"Erfasst",
"Kommt",
"Geht",
"Kommentar"};
String[] temp_delete = new String[10];
int index_delete = 0;
private ArrayList<Object[]> tableData = new ArrayList<Object[]>();
public int getColumnCount() {
return columnNames.length;
}
public int getRowCount() {
return tableData.size();
}
public String getColumnName(int col) {
return columnNames[col];
}
public Object getValueAt(int row, int col) {
Object [] temp = tableData.get(row);
return temp[col];
}
public void removeAllEntry(){
for (int i = 0; i < tableData.size(); i++) {
tableData.remove(i);
}
model.fireTableDataChanged();
}
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
public boolean isCellEditable(int row, int col) {
switch (col){
case 4:
return true;
default: return false;
}
}
public void addText(Object[] object) {
tableData.add(object);
fireTableDataChanged();
}
}