Swing JTable融合效果

1) JSTable extenends JTable, 重载rowAtPoint/columnAtPoint/getCellRect,覆盖被融合的部分
2) JSTableUI extends BasicTableUI,处理paintCell如下

private void paintCell(Graphics g, Rectangle cellRect, int row, int column) ...{
//定位为leading cell
MergeBlock mb=((JSTable)table).getMergeBlockManager().getMergeBlockOwner(row, column);

if(mb!=null )...{

if(mb.getC1()!=column && mb.getR1()!=row)...{
return;

}else...{
row=mb.getR1();
column=mb.getC1();
}
}
cellRect=table.getCellRect(row, column, false);
if (table.isEditing() && table.getEditingRow() == row

&& table.getEditingColumn() == column) ...{
Component component = table.getEditorComponent();
component.setBounds(cellRect);
component.validate();

} else ...{
//清除背景(格线)
Color c = g.getColor();
g.setColor(table.getBackground());
g.fillRect(cellRect.x,cellRect.y,cellRect.width,cellRect.height);
g.setColor(c);
TableCellRenderer renderer = table.getCellRenderer(row, column);
Component component = table.prepareRenderer(renderer, row, column);
rendererPane.paintComponent(g, component, table, cellRect.x,
cellRect.y, cellRect.width, cellRect.height, true);
}
}
