well I'm trying
String filename = "table.file";
JTable table = new JTable(elements, header);
TableModel tm = table.getModel();
try {
FileOutputStream fos = new FileOutputStream(filename);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(tm);
oos.flush();
oos.close();
} catch (IOException e) {
e.printStackTrace();
return;
}
but it only delete the old entry and write the new one, but I don't want that so I tried appending like
String filename = "table.file";
JTable table = new JTable(elements, header);
TableModel tm = table.getModel();
try {
FileOutputStream fos = new FileOutputStream(filename,true);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(tm);
oos.flush();
oos.close();
} catch (IOException e) {
e.printStackTrace();
return;
}
but now it's WORST! it don't do any thing! so any ideas?