JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.42k stars 272 forks source link

GridLine in JTable not visibile #475

Closed tuzzo77 closed 2 years ago

tuzzo77 commented 2 years ago

Hi, I have some problem trying to display grid line in my JTable, after using FlatLightLaf or FlatDarkLaf. In my project I'm using JXTable of Swingx, also if I use this code I cannot display gridline in any Jtable. Can anyone help me please? Thanks

UIManager.setLookAndFeel(new FlatDarkLaf() ); UIManager.put("Table.gridColor", Theme.LIGHT_GRAY); UIManager.put("Table.disabled", false); UIManager.put("Table.showGrid", true); UIManager.put("Table.intercellSpacing", new Dimension(1, 1));

hclerx commented 2 years ago

You can use the following properties to add the grid lines to a table:

UIManager.put("Table.showHorizontalLines", true); UIManager.put("Table.showVerticalLines", true); UIManager.put("Table.showTrailingVerticalLine", false);

tuzzo77 commented 2 years ago

Thanks for the reply. I solved adding explicitally setShowGrid(true) in my JXTable object. Probably it was ovrerrided by new Look and Feel.

DevCharly commented 2 years ago

Here is the documentation for the available UI properties: https://www.formdev.com/flatlaf/components/table/

UIManager.put("Table.showGrid", true); does not work because that UI property does not exist. As @hclerx noted, you have to set Table.showHorizontalLines and Table.showVerticalLines.

If you need grid lines only on some tables, use JTable.setShowGrid(true).