How can I change the font of a JTable's header?

37,031

Solution 1

This should work:

    table.getTableHeader().setFont(new Font("SansSerif", Font.ITALIC, 12));

Solution 2

JTableHeader header = table.getTableHeader();
header.setFont(new Font("Dialog", Font.BOLD, 18));

Solution 3

You should implement TableCellRenderer.

Share:
37,031
Stefanos Kargas
Author by

Stefanos Kargas

Senior Software Engineer Started as a pure desktop developer. Deeply valuing object oriented programming and organized coding according to standards and fundamentals. Currently working full-stack eager to learn new technologies and keep updated to new standards. Java, C# (.Net), Visual Basic (.Net), PHP Spring Framework, MVC, Laravel PostgreSQL, MyPHP, SQL Server, Oracle HTML, CSS, JS, Angular

Updated on July 09, 2022

Comments

  • Stefanos Kargas
    Stefanos Kargas almost 2 years

    I want to set the JTable header's font. Do you know how?