Merge de células numa JTable

Boa tarde :D,

Como faço merge de células numa JTable?

Aguardo respostas,

Danielle

Oi Danielle, fiz uma rápida busca no Google e achei este artigo. Veja se te ajuda:
http://www.codeguru.com/java/articles/139.shtml

Baixe o código fonte anexado e dê uma olhada.

Oi,

Já achei este código, só que o danado é bem complicadinho…
Consegui colocar pra rodar, só que os dados da minha JTable não aparecem mais :cry:

Alguma idéia?

Utilizei o código desta forma:

AttributiveCellTableModel ml = new AttributiveCellTableModel(table.getRowCount(),table.getColumnCount());
CellSpan cellAtt =(CellSpan)ml.getCellAttribute();
MultiSpanCellTable table = new MultiSpanCellTable( ml );
int totalLinhas = table.getRowCount();
int[] columns = {0,1,2,3,4};
int[] rows = {totalLinhas-1};
cellAtt.combine(rows,columns);
table.clearSelection();
table.revalidate();
table.repaint();

Agradecida,

Danielle

Quais são os dados que você está tentando exibir?

Veja que nesta linha:

AttributiveCellTableModel ml = new AttributiveCellTableModel(table.getRowCount(),table.getColumnCount());Você está tentando pegar as linhas e as colunas de uma tabela que não foi inicializada ainda.

Olá DanielleCDFS…

apenas uma dica…
coloque o código que postar entre as tags CODE.

Att.