Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Anybody? *Can* one display "nested data" in Swing???  RSS feed

 
Paul Santa Maria
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should be a really simple question ... but I haven't been able to find any examples anywhere.

Can I display complex (nested, multi-level) data in a JTable?



I'm *sure* that a JTable can do it. I just haven't been able to find anything that tells me *how*!

Any ideas?

And if JTable isn't the right way to go, can you think of any other way to display this kind of data in Java/Swing (*without*, that is, purchasing a 3rd party data grid package).

Thanx in advance!
[ May 10, 2006: Message edited by: Paul Santa Maria ]
 
Jared Cope
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Sure enough it could be done with a JTable. You would just supply no data for the cells that don't need anything (because of the nesting). So for example, you could add rows to the JTable like:


Another option might be to use a JTree? They are usually pretty good for displaying nested hierachies of data.

Cheers, Jared.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!