7

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.

basketballhead24
  • 131
  • 1
  • 4
  • 8

2 Answers2

11

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)
Will
  • 6,179
  • 4
  • 31
  • 49
10
table.setShowHorizontalLines(true);
table.setShowVerticalLines(true);
laalto
  • 150,114
  • 66
  • 286
  • 303
user2790520
  • 101
  • 1
  • 2
  • 2
    that's exactly the same as setShowGrid(true); Anyway, the issue already was resolved and turned out to have been unrelated to showing (or not) the grid lines ... please read earlier answers and their comments before posting your own :-) – kleopatra Sep 18 '13 at 07:57
  • This was helpful for me. Thank you. Although, I don't know what setting this property in NetBeans GUI Designed didn't work. – Marko Mar 28 '14 at 10:49