extends DefaultTableModel ???  
Author Message
cmk128





PostPosted: 2005-1-3 14:27:00 Top

java-programmer, extends DefaultTableModel ??? 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();
}

}
 
usenet





PostPosted: 2005-1-3 23:51:00 Top

java-programmer >> extends DefaultTableModel ??? Peter <email***@***.com> wrote:

> 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
 
Andrew Thompson





PostPosted: 2005-1-4 20:04:00 Top

java-programmer >> extends DefaultTableModel ??? On Mon, 3 Jan 2005 15:51:22 +0000 (UTC), Christian Kaufhold wrote:

> Peter <email***@***.com> wrote:
>
>> 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.

For tips on preparing an example..
<http://www.physci.org/codes/sscce.jsp>

..and
<http://www.physci.org/codes/javafaq.jsp#cljg>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane