How do I change the font of the TableHeader in the JTable.

Sandip Chitale

The JTableHeaders use the CellRenderers similar to JTables. Thus by installing a cell renderer set with the desired font should do the trick.

There are two ways to set the JTableHeader's cell renderer

  • tableHeader.setDefaultRenderer(TableCellRenderer defaultRenderer); // for all columns
  • tableColumn.setHeaderRenderer(TableCellRenderer headerRenderer); // column by column basis