我进行了很多搜索,并获得了有关此问题的一些答案。但是,其中许多参考了会导致404错误的链接。我想做这样的表:
Java中有什么方法吗?
MultiSpanCellTableExample演示如何通过创建自定义合并单元格TableUI
。StackOverflowError
至少在Java 6中,此示例中似乎存在一个导致的问题。要解决此问题,请在AttributiveCellTableModel.setDataVector()
replace内部:
setColumnIdentifiers(columnNames);
与:
this.columnIdentifiers = columnNames;
IE浏览器:
public void setDataVector(Vector newData, Vector columnNames) {
if (newData == null)
throw new IllegalArgumentException(
"setDataVector() - Null parameter");
dataVector = new Vector(0);
// setColumnIdentifiers(columnNames);
this.columnIdentifiers = columnNames;
dataVector = newData;
cellAtt = new DefaultCellAttribute(dataVector.size(),
columnIdentifiers.size());
newRowsAdded(new TableModelEvent(this, 0, getRowCount() - 1,
TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
}
问题是setColumnIdentifiers
调用setDataVector
从而触发StackOverflowError
。修复后,示例如下所示:
JIDE还有一个现成的解决方案,不幸的是它不是免费的。例如CellSpanTable
:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句