extends DefaultTableModel ???

P

Peter

Hi
I have an exception of the line "return content.size();" in
getRowCount(), it said the vector content is null. But if i extends
the AbstractTableModel rather than DefaultTableModel, no exception,
please tell me why?

thanks
from Peter

public class MyTableModel extends DefaultTableModel {
String columnNames[] = {"1", "2", "3", "4", "5"};
Vector content=new Vector();

public MyTableModel() {
}

public int getColumnCount() {
return columnNames.length;
}

public String getColumnName(int col) {
return columnNames[col];
}

public Object getValueAt(int row, int column) {
"Peter"
}

public int getRowCount() {
return content.size();
}

}
 
C

Christian Kaufhold

Peter said:
I have an exception of the line "return content.size();" in
getRowCount(), it said the vector content is null. But if i extends
the AbstractTableModel rather than DefaultTableModel, no exception,
please tell me why?


Please post your real code.



Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top