I Have created a table model extending DefaultTableModel.
public class TableModel extends DefaultTableModel {
List<VariableDetails> data;
public AttachedVariableTableModel(){
super();
this.data=Collections.synchronizedList(new ArrayList<VariableDetails>());
}
//method for adding rows
public void addRow(VariableDetails varDetails){
this.data.add(varDetails);
fireTableRowsInserted(this.data.size()-1,this.data.size()-1);
}
}
I tried to add rows to the table which has already data in it.
tModel.addRow(new VariableDetails());
but rows cannot be added. There is no exceptions and errors. what is actually wrong here? How Can i Solve this? Thanks in advance.
for why reason is there super();
DefaultTableModel
can add Object[]
or Vector
have to override AbstractTableModel
, rather than DefaultTableModel
, have to override all get/set
methods, with proper fireXxxXxx()
in the methods, otherwise there aren't something visible in view (JTable
)
can start with List Table Model or Row Table Model