How to change JTable row height globally?

可紊 提交于 2019-12-01 05:24:37

Basically, there is nothing by intention. The relevant code-comment in BasicTableUI:

// JTable's original row height is 16.  To correctly display the
// contents on Linux we should have set it to 18, Windows 19 and
// Solaris 20.  As these values vary so much it's too hard to
// be backward compatable and try to update the row height, we're
// therefor NOT going to adjust the row height based on font.  If the
// developer changes the font, it's there responsability to update
// the row height.

On the bright side, some LAFs like f.i. Nimbus respect a ui property for rowHeight:

UIManager.put("Table.font", new FontUIResource(new Font("SansSerif", Font.PLAIN, 28)));
// here simply the font height, need to do better 
int height = 28;
UIManager.put("Table.rowHeight", height); 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!