File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTABLE header question - make BOLD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTABLE header question - make BOLD" Watch "JTABLE header question - make BOLD" New topic

JTABLE header question - make BOLD

Long Huynh

Joined: Jul 14, 2002
Posts: 7
Hi all,
I was wondering how can I change the headers of a JTable to be BOLD, instead of the defualt plain type?

Long A. Huynh ( yes, as in the primitive 64 bit<br />SCJP2<br />"Got Java?"
Long Huynh

Joined: Jul 14, 2002
Posts: 7
i tried this, but it isn't working.
JTableHeader header = MACTable.getTableHeader();
TableCellRenderer renderer = header.getDefaultRenderer();
Component comp = renderer.getTableCellRendererComponent(MACTable, null, false, false,
0, 0);
Font f = comp.getFont();
Font boldFont = f.deriveFont(Font.BOLD);
Ashish Gupta
Ranch Hand

Joined: Apr 27, 2003
Posts: 61
Try this it should work for you.

ETableModel is a class that extends AbstractTableModel.
I agree. Here's the link:
subject: JTABLE header question - make BOLD
It's not a secret anymore!