Friday, December 12, 2008

Setting a JTableHeader's height

WARNING: BORING POST, but possibly helpful to Mr. G in the future.....

The following code doesn't resize the height of a JTableHeader as I would suspect:

qtyTable.getTableHeader().setSize(qtyTable.getTableHeader().getWidth(),30));

instead the following is what worked:

qtyTable.getTableHeader().setPreferredSize(new Dimension(qtyTable.getTableHeader().getWidth(),30));

It's uglier, but at least it works. Tried finding a solution online, and after finding several others that didn't work, this is the one that did.

No comments: