Can I use the same model with multiple JTree displaying different views of that model?

Sandip Chitale


TreeNode root = ...;
JTree tree1 = new JTree(root);
JTree tree2 = new JTree();

If you want to share the selection also you will have to share the TreeSelectionModel also along the similar lines.

You can also create your own model and use it with both trees.