Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Color;

import javax.swing.JTable;

public class Main {
    public static void main(String[] argv) throws Exception {

        JTable table = new JTable();

        table.setShowGrid(false);//Don't show any grid lines

        //Show only vertical grid lines
        table.setShowGrid(false);
        table.setShowVerticalLines(true);

        //Show only horizontal grid lines

        table.setShowGrid(false);
        table.setShowHorizontalLines(true);

        //Set the grid color

        table.setGridColor(Color.red);

        //Show both horizontal and vertical grid lines (the default)
        table.setShowGrid(true);
    }
}