copy defaulttable mode, two different tables , with diff data
Following code i try to make a copy of the table which is passed into this method
But copyPrintingModel , is empty at the the end of the loop but the elementcount is same that in
the table. i.e. the data is added but the copyPrintingModel looses the data.
I suppose thats because of , copyPrintingModel.addRow -- perhaps stores only the reference and once that
goes out of scope , the data is lost
Please give me tips to avoid that i.e. i want the data to be persistant in copyPrintingModel
private JTable filterParams(JTable forParamFilter) {
DefaultTableModel forPrintingModel = (DefaultTableModel) forParamFilter.getModel();
int i = 0;
JTable copyParamFilter = new JTable();
DefaultTableModel copyPrintingModel = new DefaultTableModel();
while(i < noOfRows){
copyPrintingModel.addRow((Vector) forPrintingModel.getDataVector().elementAt(i));
i++;
}
}