• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to boldface the header for ONE column

 
Jeff Chang
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I want to know how to boldface the header for ONE column. The following will boldface the header for all the columns in
the table
table.getTableHeader().setFont(new java.awt.Font("Dialog",1,12));
Thanks.
Jeff
 
Renee Zhang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if this is the best way. But it does work!
override defaultTableModel and at the getColumnName method
public String getColumnName(int col) {
switch (col) {
case 0:
return "<html>Bold Head</html>";
case 1:
return "<html>Small Head </html>";
....
}
return "";
}
 
Renee Zhang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.
I mean you may use html to display the Bold head. In this example, I use "<<" instead of "<" and ">>" intead of ">", so you can see the code.
case 1:
return "<<html>><<font>><<B>> Bold Head <</font>><</html>>";
...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!