Putting a JTable inside a JTable cell?


Tivo Escobar

Hi guys,

I was starting to build a frame using Swing and had the weird ideia of
putting a JScrollPane/JTable inside a JTable cell. I have already
developed other tables with specialized Models, CellRenderers and
CellEditors, but never tried to draw a panel using a CellRenderer. Has
anybody ever tried it? Any sample code?

The point is that I need to present data in a hierarchical manner. For
example, imagine that the main table is called "Models Table" and
presents information about car models. One of the columns of this
table is called "Cars Column" and presents information about each car
of that specific model. My data can grow during runtime, that is why
using tables. Using JTree could solve the hierarchical problem, but
would not fit visually. Any other suggestion?

Thanx in advance,