jtable - 如何设置列之间的差距

时间:2012-02-29 15:13:35

标签: swing jtable

有没有办法在JTable列或行之间添加间隙? (不使用单元格渲染器)

1 个答案:

答案 0 :(得分:11)

查看setIntercellSpacing和/或setRow / ColumnMargin。好的,查看方法:

// set gap between rows, api in JTable
table.setRowMargin(int)
// set gap between columns, api in TableColumnModel
table.getColumnModel().setColumnMargin(int)
// convenience for setting both row and column gaps
table.setIntercellSpacing(Dimension)