wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JTable  column header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable  column header" Watch "JTable  column header" New topic

JTable column header

Nick Kocher

Joined: Nov 24, 2004
Posts: 14

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

Joined: Jan 14, 2004
Posts: 1535
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 ]
Don't get me started about those stupid light bulbs.
subject: JTable column header
Similar Threads
excel but in a jTable