• 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

my Tree node labels are not displayed entirely.

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My tree nodes are not displaying properly.
The first time when i bring up the tree all nodes are dipalying properly.when i change the node object text programatically (more in length than the previous)it is displaying part of name and three dots.
can please some one help in fixing this.
Thanks
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your JavaRanch name needs to be changed. It's not really my job to tell you this, but there you go.
The reason for the display is that tree nodes are actually JLabels, and those dots (aka an ellipsis ) are a "feature" of JLabel, when the JLabel is forced to occupy a smaller area than it would preffer. AFAIK JTree doesn't grow to accomodate long labels, so basically you may be screwed.
Of course, you could always subclass JTree and override Component.getPreferredSize() to fix this. (Or you could write a Component listener to call JComponent.setPreferredSize()). But there may be some serious difficulties in doing this, as JTree rendering is anything but trivial, and such a scheme would probably have to go through the entire tree, making it expensive.
While I doubt it, there might be something at:
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
 
Bhagya Tangutur
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your time.Infact I found the solution for above problem by calling nodeChanged method on myTreeModel.Now tree labels shows Properly
Thanks again
[ November 05, 2002: Message edited by: kumar B ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic