• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why there's no header in my JTable

 
david hu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use these following code to initialize the JTable(of course, there are some other codes to setup the TableColumn objects). My problem is that the header of the table is not shown up? Can anyone give me some direction?

I know that in the constractor of JTable, I can provide a parameter corresponding to the columns headers. But since I use default construct, if there any way to setup the header later?

JTable contractorTable = new JTable();
ContractorTableData data = new ContractorTableData();//extends abstractTableModel
contractorTable.setModel(data);
 
S Perreault
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you add this method to your implementation of AbstractTableModel?



/** Returns the column name for a particular column. */
public String getColumnName(int col)

Perogi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic