JTable with variable columns per row

I have a request from a user to display different data within the same JTable (don't ask, users...)

This would require the table to have, for example, three rows with 4 columns followed by two rows with one column, followed by 3 rows with 4 columns, etc. etc. The width of the cell on the single-cell rows should be the width of the entire table so any text in these cells is drawn all the way across.

Before I tell the user it can't be done I thought I better verify this. It doesn't appear I can use a tableCellRenderer because this still only paints the area contained by the cell. If I try to render the single-cell row it still only paints within the area defined by the column width.

Does anyone know of some way this might possibly be implemented?

Thanls

[795 byte] By [markwagonera] at [2007-11-27 10:57:03]
# 1

There are different ways of doing column spanning.... not that i've ever been able to get them to work to my satisfaction. But smarter people than me can manage it.

Try looking at this link:

http://www.swingwiki.org/howto:column_spanning

c0demonk3ya at 2007-7-29 12:06:37 > top of Java-index,Desktop,Core GUI APIs...
# 2

Man, this looks involved. Maybe I'll just tell the user I can't do it. ;o)

Thanks for pointer.

markwagonera at 2007-7-29 12:06:37 > top of Java-index,Desktop,Core GUI APIs...