• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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?
 
Sheriff
Posts: 28416
102
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic