Java-JTable does not show grid lines

I showed JTable in my JPanel. JTable is inside scrollpane. The only problem is that the grids are not displayed. I tried using this line of code, but it did not work.

table.setShowGrid(true); 

Below is the image: note that there are no grid lines enter image description here

Thanks in advance.

+6
source share
2 answers

Does the etched border matter?

 table.setBorder(new EtchedBorder(EtchedBorder.RAISED)); 

EDIT:

The color of the grid lines looks white by default:

 table.setGridColor(Color.BLUE) 
+8
source
 table.setShowHorizontalLines(true); table.setShowVerticalLines(true); 
+8
source

All Articles