• Post Reply Bookmark Topic Watch Topic
  • New Topic

height of JTable header

 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I set the height of the headers in a JTable? I'm using html in the header text (got that by searching here - thanks guys) to force line wrapping and that works well except the height is still only set for one row of text, not two or three.

thanks

ms
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

try this...

myTable.getTableHeader().setPreferredSize(new Dimension(10,10));

Replacing the 10's for the values that you want. And you might have to revalidate or updateUI on the tableHeader

Cheers,
Rachel
 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that worked. I'm still not sure why setting the preferred size of the components themselves didn't work though...

ms
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say the components themselves, which ones did you try to set?

Cheers,
Rachel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!