JTable table = new JTable(data, columnNames); table.setShowHorizontalLines(true); // horizontal grid lines will be shown
JTable table = new JTable(data, columnNames); table.setShowHorizontalLines(false); // horizontal grid lines will not be shownIn this example, a new JTable is created with some data and column names. The setShowHorizontalLines method is called with a value of false, which disables the horizontal grid lines in the table. Library: Java Standard Library - javax.swing package