File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable Column header

 
Sharada Sreeram
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to make my JTable column header of a particular column as bold - I read JavaSoft's Look&Feel guidelines book, which suggests we do it (if we say sort the columns) but does not say how to.
Does anyone of you have any idea of how I could do this.
Thanks in advance,
Sharada
 
Glen Tanner
Ranch Hand
Posts: 147
Java Python Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Column names are Strings, or probably more accurately JLabels, which recognize HTML tags.
So, a column name like "First Name", can be made "{html}{b}First Name{/b}{/html}"
[This message has been edited by Glen Tanner (edited January 17, 2001).]
 
Sharada Sreeram
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I took care of this using table cell rendering. I was using the abstract table model without cell rendering - so, to set a particular column, I had to get that column (using JTable.getColumn()) and then use that TableColumns getHeaderRenderer/setHeaderRenderer to change the font for a particular column.
Thanks
p.s Of course, your method is way more straightforward
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But not nearly as cool.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic