Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

table column names not showing up  RSS feed

 
Ashish Sarin
author
Ranch Hand
Posts: 451
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I am creating a JTable using AbstractTableModel. When the JTable shows up it does give all the column values correctly but the column names are not being displayed.
Can anyone tell me how to fix this problem ?
regards
ashish sarin
 
Wael Atef
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
try to override the method getColumnName in AbstractTableModel and return your column names. For Example
public String getColumnName(int col)
{
String[] colNames = {"A","B","C"};
return colNames[i];
}
and override the the method getColumnCount to return your column number
public int getColumnCount()
{
return 3;
}
i hope that works.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!