【问题标题】:JTable without horizontal and vertical lines没有水平和垂直线的JTable
【发布时间】:2010-07-20 07:13:11
【问题描述】:

如何创建一个没有垂直和水平线的JTable...

【问题讨论】:

    标签: java swing netbeans jtable


    【解决方案1】:

    尝试使用setShowGrid()setShowVerticalLines()setShowHorizontalLines()

    setShowVerticalLines()

    设置表格是否垂直绘制 细胞之间的线条。如果 showVerticalLines 确实如此;如果 是假的,不是的。

    示例:

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

    【讨论】:

      【解决方案2】:
      jTable4.setShowHorizontalLines(true); // only HorizontalLines
        jTable4.setShowVerticalLines(true); //  only VerticalLines
        jTable4.setShowGrid(true);          // show Horizontal and Vertical
        jTable4.setGridColor(Color.yellow); // change line color 
      

      使用此代码:)

      【讨论】: