Elie Elie - 1 year ago 92
Java Question

JTable column spanning

I am trying to make a

that has column spans available. Specifically, I am looking to nest a
inside another
, and when the user clicks to view the nested table, it should expand to push down the rows below and fill the empty space. This is similar to what you see in MS Access where you can nest tables, and clicking the expand button on a row will show you the corresponding entries in the nested table.

If someone knows of a way to perform a column span with
, can you please point me in the right direction? Or if you know of an alternative way to do this, I am open to suggestions. The application is being built with Swing. Elements in the table, both high level and low level, have to be editable in any solution. Using nested
s this won't be a problem, and any other solution would have to take this into consideration as well.

Answer Source

As a pointer in the right direction, try this article at SwingWiki that explains the TableUI method of column spanning quite well. Before this, I also tried some alternatives such as overriding the TableCellRenderer paint methods without much success.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download