We help IT Professionals succeed at work.

Setting header height in JTable

SiddharthJain
on
I would like to know,how can we set the height of the column header in JTable?
I need this as i want to display multiline text in  column header.  

regards

Siddharth
Comment
Watch Question

Commented:
Siddharth,
Have you tried "setRowHeight" function of JTable class.

Cinder

Author

Commented:
Hi Cinder,
  I have tried that, but that changes the height of the row and not that of the column header.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
Try defining a custom renderer that returns a component with the required preferred size.

Author

Commented:
Hi Ovi,
  That url seems to be quite intresting but i am not able to run any of its code. All the examples given there give NullPointer Exception.
  Have you tried running those codes.And did u get any problem in running them?

regards
Siddharth

Author

Commented:
Hi Ovi,
  The code in the examples of the given url needed a few changes as i am using jdk1.3.1 . After making those changes it worked.
 Thanks for the help.

regards
Siddharth
Ovi

Commented:
Sorry for delay, nope I didn't have problems. Thanks for the points.