Basically I need help with recursion. The point is that I am trying to make dialog which shows JTree with check boxes and I did it (copying most popular code here). But I can only copy whole tree from main frame, and what I need is selected component to be root of a new tree. So I guess I have to build new DefaultTreeModel for a new tree.
I tried every example I found ... from here to everywhere. I saw that people use recursion, but I can't apply codes that are given in right way or they just don't fit.
So this is my dialog class where I make new tree
It works when I try to check whole tree copied
But when I try to check copied subtree this is the result
I pasted whole code from here Java Swing: Need a good quality developed JTree with checkboxes