aspose file tools*
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTABLE header question - make BOLD" Watch "JTABLE header question - make BOLD" New topic
Author

JTABLE header question - make BOLD

Long Huynh
Greenhorn

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?
thanks


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

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);
comp.setFont(boldFont);
Ashish Gupta
Ranch Hand

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

where
ETableModel is a class that extends AbstractTableModel.
Ashish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTABLE header question - make BOLD