Because you do not have constructor in MyTable
which takes parameter MyTableModel
.
You are creating table like this:
MyTable table=new MyTable(tm);
So you must have constructor in MyTable like this:
class MyTable extends JTable {
public MyTable(MyTableModel tm){
super(tm);
}
}
If you have MyTable
code that you posted here, your code will not compile!