Initial headers in JTable

Hi

I am having a problem using AbstractTableModel. The thing is that it is working perfectly for my application but I can get the header to appear with the initial names that I am setting. I am following some examples that I found on how to use this class, but in all of them the headers are declared at the begining in an String array;

e.g. String[] headers= {"Last", "Name", "Sex"}

But on the rest of the code I can't find where these values are actually set as headers for the table. When the table is displayed I get "A", "B", and "C" as the headers.

Thanks in advance

[611 byte] By [juani1] at [2007-9-26 1:52:56]
# 1
Your class that extends AbstractTableModel needs to override the getColumnName() method to return the appropriate column header string.
DrClap at 2007-6-29 3:03:22 > top of Java-index,Archived Forums,Swing...
# 2

Once that you have your clumn names you must to put obn the Model.....

String[] headers= {"Last", "Name", "Sex"}

// Create a model of the data.

TableModel dataModel = new AbstractTableModel() {

....

....

public String getColumnName(int column) {return headers[column];} //NOTE THIS ROW...

....

....

};

pedro.garcia at 2007-6-29 3:03:22 > top of Java-index,Archived Forums,Swing...