File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes my Tree node labels are not displayed entirely. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "my Tree node labels are not displayed entirely." Watch "my Tree node labels are not displayed entirely." New topic
Author

my Tree node labels are not displayed entirely.

Bhagya Tangutur
Ranch Hand

Joined: Oct 21, 2002
Posts: 88
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


Sun Certified Java Programmer
Josh Rehman
Ranch Hand

Joined: Jul 24, 2001
Posts: 63
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

Joined: Oct 21, 2002
Posts: 88
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 ]
 
Don't get me started about those stupid light bulbs.
 
subject: my Tree node labels are not displayed entirely.
 
Similar Threads
Associating a DataTable for a node of a rich tree
How to create a tree model for three JTrees
diplay the complete tree in richface tree tag on loading of the page.
Edit Values in a JTree
Tree Cell Renderer