Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java- JTable not showing gridlines

Tags:

java

swing

I have displayed a JTable in my JPanel.The JTable is inside a scrollpane. The only problem is the gridlines are not showing up.I tried to use this line of code but it didn't work.

table.setShowGrid(true);

Below is a picture: Note there are no gridlinesenter image description here

Thank you in advance.

like image 937
basketballhead24 Avatar asked Jan 13 '13 04:01

basketballhead24


1 Answers

Does having an etched border make a difference?

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

EDIT:

The default colour of grid-lines seems to be white:

table.setGridColor(Color.BLUE)
like image 68
Will Avatar answered Nov 03 '22 03:11

Will