Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Gett8ing focus when 2 JTrees in same panel.  RSS feed

Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I have expanded on Sun's tree example. I added another JTree into another JPanel and added both Panels to one larger panel. I'm trying to add nodes to either one. To do this, I would like the user to select a node with the mouse and then click the add button. This will add a new node. The problem is I am having trouble distinguisihing between the two JTrees.
Both trees are of class DynamicTree. (treePanel, treePanel2)
You will find XXXXXX in my code. If I replace the XXXX with treePanel it works for the tree on left. If I use treePanel2, it works for the one on the right. That I have no problem with. How could I maybe use the MouseListener inerface or someother listener to get it to work???
I've enclosed both classes (DynamicTree and DynamicTreeDemo) for your enjoyment. I hope your enjoyment will ease my frustration. Thanks in advance.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!