Resize Width Of JTree Selected Node On Font Change

Say you want your selected JTree node to have its text in bold and italicized, once you click on the node, the text (if long) more or less gets truncated with … and you do not want to see that in your JTree right? What you need to do is override the getPreferredSize() method of the DefaultTreeCellRenderer. mimiman_ from the Sun forum gave this piece of code.

It worked wonders!

Related Posts Plugin for WordPress, Blogger...

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *