JTable with different number of columns per row


how can I get a JTable for arranging some rows with only one column:

A1 Section Title Row With long Text A2 B2 C2 D2 A3 B3 C3 D3 A4 B4 C4 D4 A5 Section Title Row With long Text A6 B6 C6 D6 A7 Section Title Row With long Text A8 B8 C8 D8 A9 B9 C9 D9 

instead

 A1 Section Title Row With long Text B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3 A4 B4 C4 D4 A5 Section Title Row With long Text B5 C5 D5 A6 B6 C6 D6 A7 Section Title Row With long Text B7 C7 D7 A8 B8 C8 D8 A9 B9 C9 D9 

I made this type of layout using xhtmlrenderer, but I am wondering if it is possible to change the individual range of JTable cells. Thanks.

+4
source share
2 answers

Take a look at this example , which shows how you can β€œmerge cells” in JTable.

+3
source

The JIDE commercial grid has CellSpanTable and GroupTable . The basic idea is the same as the ancient code in @dogbane's answer, which should use a user interface that does not draw grid lines for stretched cells.

+1
source

All Articles