I am using Nimbus L & F. I am trying to change the font size globally for all JTable using the following code:
NimbusLookAndFeel nimbus = new NimbusLookAndFeel(); UIManager.setLookAndFeel(nimbus); UIDefaults d = nimbus.getDefaults(); d.put("Table.font", new FontUIResource(new Font("SansSerif", Font.PLAIN, 18)));
It works, all JTable lines in the application use the new font. I use a larger font size to make the table more readable in high resolution.
But the problem is that the line height has not changed, which led to a truncation of the font. I tried the following code:
d.put("Table.contentMargins", new Insets(50,50,50,50)); d.put("Table:\"Table.cellRenderer\".contentMargins", new Insets(50,50,50,50));
But this did not change anything in the displayed tables.
Is it possible to change the row height globally without calling setRowHeight() for each JTable instance?
source share