svaens
svaens

Reputation: 649

A JTable where number of columns in each row may be different

I am looking for a solution for a JTable where I can vary the number of columns in each row, but where the size (in pixels) of the row is constant.

I found stackoverflow referencing so far only dead-links to an old solution:

JTable with varying number of columns per row

Is there a newer better way to do it now ? If so, what? If not, does anyone know what the old solution was?

thanks.

Upvotes: 2

Views: 1376

Answers (2)

trashgod
trashgod

Reputation: 205875

Does anyone know what the old solution was?

The examples, which appear to have been created for a Swing beta release in the last millennium, may be found here. You may be looking for MultiSpanCellTable. They may be a useful object of study, but they are not current. YMMV.

Upvotes: 1

StanislavL
StanislavL

Reputation: 57421

I would create a renderer (panel with multiple fixed size labels or even multiple panels for each type of row).

It should be one column in TableModel with the renderer applied.

Upvotes: 1

Related Questions