"Thread View" of a tree.

D

Daniel Pitts

Cross posted to clj.gui and clj.programmer, f-u to programmer.

Hello,

I have a TreeModel, which basically represents Messages. Messages can
be in a thread.

I want display this similar to how Thunderbird or Outlook show a thread.
Specifically, the top-node of the thread is expandable/collapsible, but
all child nodes are always expanded.

Is there a way to do with with JTree, or do I need to create my own
component to handle the rendering?

Thanks,
Daniel.
 
M

Mark Space

Daniel said:
Is there a way to do with with JTree, or do I need to create my own
component to handle the rendering?


I think you create a TreeModel of some sort, then just add it to the
JTree, regardless of whether you roll your own or not. DefaultTreeModel
should work OK, I think.

To show a list of expanded/collapsed tree nodes, you'll have to set
those to whichever state you want programatically. You'll also have to
hide the root node (tree.setShowsRootHandles(false); I think).

Did you look at:

<http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html>
 
M

Mark Space

Daniel said:
Is there a way to do with with JTree, or do I need to create my own
component to handle the rendering?


I think you create a TreeModel of some sort, then just add it to the
JTree, regardless of whether you roll your own or not. DefaultTreeModel
should work OK, I think.

To show a list of expanded/collapsed tree nodes, you'll have to set
those to whichever state you want programatically. You'll also have to
hide the root node (tree.setShowsRootHandles(false); I think).

Did you look at:

<http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html>
 
D

Daniel Pitts

Mark said:
I think you create a TreeModel of some sort, then just add it to the
JTree, regardless of whether you roll your own or not. DefaultTreeModel
should work OK, I think.

To show a list of expanded/collapsed tree nodes, you'll have to set
those to whichever state you want programatically. You'll also have to
hide the root node (tree.setShowsRootHandles(false); I think).
The problem is that I don't want child nodes to be *collapsible*, only
the first level nodes (the roots direct children). And I don't want the
toggle UI that is there
Ofcourse :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top