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

5

19

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

Itu answered 10/12, 2010 at 12:3 Comment(0)
S
52

This should work:

    table.getTableHeader().setFont(new Font("SansSerif", Font.ITALIC, 12));
Sammie answered 10/12, 2010 at 12:18 Comment(0)
D
3
JTableHeader header = table.getTableHeader();
header.setFont(new Font("Dialog", Font.BOLD, 18));
Donettedoney answered 13/1, 2011 at 10:54 Comment(0)
P
2

You should implement TableCellRenderer.

Plywood answered 10/12, 2010 at 12:12 Comment(0)
G
1

you can also use this to set all table's header's font :

    UIManager.put("TableHeader.font", font1);
Gilletta answered 29/11, 2017 at 21:29 Comment(0)
S
0

This work for me

tableName.getTableHeader().setFont(new Font("Segoe UI", 1 , 16));
Snaggletooth answered 10/12, 2018 at 19:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.