How to hide grid lines in JTable

后端 未结 2 1142
北恋
北恋 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);
    
    0 讨论(0)
  • 2021-01-17 19:35

    just jTable1.setShowHorizontalLines(false); or jTable1.setShowVerticalLines(false); or you can use the 2 option

    jTable1.setShowHorizontalLines(false);
    
    jTable1.setShowVerticalLines(false);
    
    0 讨论(0)
提交回复
热议问题