Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Column Header in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Column Header in JTable" Watch "Column Header in JTable" New topic

Column Header in JTable

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
hi all ,
can we set the font of column header of a JTable .
please reply soon ..
thanks .
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
To change all column headers you can try

or for individual columns you can try getting a reference to the renderer with

or you can set your own custom TableCellRenderer, either as a defaultRenderer for the JTableHeader or by TableColumn, in which you specify the font.
Nick Kocher

Joined: Nov 24, 2004
Posts: 14
as Craig Wood said, you can try creating your own TableCellRenderer and the class would look something like this:

Now you need just to set it on your columnheader
[ December 18, 2004: Message edited by: Nick Kocher ]
I agree. Here's the link:
subject: Column Header in JTable
It's not a secret anymore!