my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes Gett8ing focus  when 2 JTrees in same panel. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Gett8ing focus  when 2 JTrees in same panel." Watch "Gett8ing focus  when 2 JTrees in same panel." New topic

Gett8ing focus when 2 JTrees in same panel.

Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Gett8ing focus when 2 JTrees in same panel.
Similar Threads
File Permission Error
JPopup and JTree Problem
I am lost , Help Me Please ...JTree
Jtree - message becomes blurry when scrolls
how to fill the jtree with the last modified value ?