scrolling messes up the header in jtable when using non default header height

1k views Asked by At

I change the height of header in jtable with this:

mytable.getTableHeader().setPreferedSize(new Dimension(mytable.getColumnModel().getTotalColumnWidth(), 34));

And now, when i use horizontal scrollbar, the header doesn't get rendered correctly at all. What am i doing wrong? This is the only line that affects the problem. Do i need to do anything else to change the height of the header?

Here is the screenshot of the problem. Look at right of the header...

1

There are 1 answers

5
camickr On
Dimension d = table.getTableHeader().getPreferredSize();
d.height = 34;
table.getTableHeader().setPreferredSize(d);