I tried to group JTable header and for that I want to get the DefaultTableModel of current JTable. But when I tried to retrieve the table model like this:
Defaul
According to the JavaDoc for BindingTableModel, the class doesn't extend DefaultTableModel. Rather, it implements TableModel interface. This means that you cannot cast to DefaultTableModel, only to TableModel:
TableModel dm=(TableModel) tblTet.getModel();
you have to create your table like this :
String[] columnNames = {"Row",
"Category",
"From Date",
"From Time",
"To Date",
"To Time",
"Description",
"Doc"};
Object[][] data = {};//Table Rows
table.setModel(new DefaultTableModel(data,columnNames));
instead of:
table=new JTable(data,columnNames);
then you can cast your table model to defaultTableModel.