I have two JTrees that I want to display the same content on them.
I set a ScrollPane to each one and wrote this code:
sourceScroll.setViewportView(sourceBuildTree);
targetScroll.setViewportView(sourceBuildTree); //I want to set the same tree.
sourceScroll is the scroll pane of the first JTree, and targetScroll is the scroll pane of the second JTree.
If I remove the second line, I see the JTree on the sourceScroll, which is OK. But when I enter the second line, the JTree only appears on the targetScroll and the sourceScoll is grayed.
Why doesn this happen? How can I solve this problem?