How to hide grid lines in JTable

后端 未结 2 1143
北恋
北恋 2021-01-17 19:07

I\'m trying to hide the grid lines of a JTable but with no results. Even trying to change the color of the grid lines does not work. Here is my code:

    //          


        
2条回答
  •  不思量自难忘°
    2021-01-17 19:15

    you have to set two thingies

    • disable grid showing
    • zero row/column intercell spacing

    In code:

    table.setShowGrid(false);
    table.setIntercellSpacing(new Dimension(0, 0));
    

    Or use JXTable (from the SwingX project) which does it for you:

    xTable.setShowGrid(false, false);
    

提交回复
热议问题