Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable column header

 
Nick Kocher
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

this should be an easy question but I'm stuck

is there any method to change the Column names of a JTable after creating it?(Sure there is)

to get the name of the Column,we can use the method of AbstractTableModel getColumnName(int col). is that right?

any help is appreciated
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the table, getColumnModel and with this get a reference to the TableColumn you want to change. Then call column.setHeaderValue.

If you want to change all of the column headers you can use one of the DefaultTableModel methods setColumnIdentifiers.
[ December 16, 2004: Message edited by: Craig Wood ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic