Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Gett8ing focus when 2 JTrees in same panel.

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic