I have no ideas what to do. I am creating an application. I need to work with the table, so I am using JTable. But I have a lot problems with it.
It seems to work, but when I try to delete column it this column disappears (only in GUI), but all the information still exists. Also columncount doesn't change.
I have searched and tried a lot of different code, but nothing changed.
public void addTblCol(JTable table,String name) {
DefaultTableModel model = (DefaultTableModel)table.getModel();
TableColumn col = new TableColumn(model.getColumnCount());
col.setHeaderValue(name);
table.addColumn(col);
model.addColumn(name);
this.realColCnt++;
};
public void delTblCol(JTable table,int index) {
DefaultTableModel model = (DefaultTableModel)table.getModel();
TableColumn col = table.getColumnModel().getColumn(index);
table.removeColumn(col);
table.revalidate();
this.realColCnt--;
};