• 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

Problem with label

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a peculiar problem.I have a root node A.To this root node,I am adding a child node B and to this node,I am adding another node C.My problem is when i am adding another child node to A,the labels to the nodes are sometimes missing.It's of this form.When i add another node to A,I am going for a full repaint of the tree.

A(root node)
|_B
| |_C
| |_D
|
|_B
|_C
|_D
Can anyone help me out?
Thanx in advance.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So are you asking how to repaint the tree to make sure the newly added nodes show up properly? If so you should be able to run the validate() and repaint() and be in good shape. Am I missing something?
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this tree is a JTree, and your tree model is a DefaultTreeModel, then have a look at the API documentation for methods whose names start with "fire". You call the appropriate method from that list whenever you make a change to a node, or add a node, or delete a node. Calling validate() or repaint() is a crude solution that might not work well for large trees.
 
visu Nekk
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx Paul, I am using validate().If it's not a good solution for large trees,then please suggest me another method.

Regards,
Visu.
 
This will take every ounce of my mental strength! All for a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic