• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New node in JTree not visible

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've spent ages on this problem but to no avail. Hopefully, one of you guys can help me.
I want to allow users to add a node to a JTree. I'm simulating this by using a button that looks at the current selection and adds a new node to it like this -
parentNode.add( childNode );
where parentNode and childNodes are DefaultMutableTreeNodes.
However this node is only ever visible if it was added to a branch that hasn't been expanded yet. Expanded branches don't get the new node.
What do I have to do to make the new node visible in expanded branches?
Lee.
 
Lee Feder
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't worry, I fixed it.
Here's what the solution was (I can't believe it was so simple).

I am a chump!
 
reply
    Bookmark Topic Watch Topic
  • New Topic