Skip to main content

JTree

9 replies [Last post]
sfshaza
Offline
Joined: 2004-06-03
Points: 0

The JTable thread has been so productive (largely thanks to Collin :-) ) I thought I'd start a thread on JTree.

Awhile back I told Collin that we had received questions on how to add, remove and update nodes from DefaultTreeModel and he wrote DefaultTreeModelDemo.

What other coverage would you like to see in the tutorial? Or what demos have you written for JTree?

Sharon

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ttretau
Offline
Joined: 2006-07-04
Points: 0

Hi,
I am really interested in some example for #5. What has to be considered if one tree model is used among multiple JTrees..

scphan
Offline
Joined: 2009-05-01
Points: 0

You could relate the whole MVC process to JTree, JTable, JList etc. and then go into specifics such as cell rendering and other resources.

aberrant
Offline
Joined: 2006-02-02
Points: 0

I'll start with the things I've been requested to implement in the past.

1. Multiple CellRenderers / CellEditors in the same tree.
2. Node Filtering
3. "Focusing" on a node (making it the new root).
4. Checkbox selection (checkbox tree)
5. Sharing one tree model among multiple JTrees.
6. Searching a tree by regular expression.
7. Node rollovers.

I'll start with 1 because it's pretty straight forward. If anyone is interested in any one subject let me know. I'll do that one first.

aberrant
Offline
Joined: 2006-02-02
Points: 0

#3 - I have a node "focusing" code sample.
http://wiki.java.net/bin/view/Projects/SwitchRootDemo

aberrant
Offline
Joined: 2006-02-02
Points: 0
aberrant
Offline
Joined: 2006-02-02
Points: 0
aberrant
Offline
Joined: 2006-02-02
Points: 0

I have a few more examples hanging around I just have to get them posted. I hopefully will post something soon.

sfshaza
Offline
Joined: 2004-06-03
Points: 0

As always, I appreciate it, Collin!

aberrant
Offline
Joined: 2006-02-02
Points: 0

This demo/code sample shows how one can use multiple renders in a single tree.

http://wiki.java.net/bin/view/Projects/MultiRendererTreeDemo