Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Resizing DefaultTreeCellRenderer  RSS feed

 
Steve Sinai
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to adjust the width of DefaultTreeCellRenderers after they've been created, but can't figure out how to do it. For performance reasons, it looks like all the related DefaultTreeCellRenderer functions that should deal with this have been overridden., i.e,, validate, repaint, etc. The reason I want to do this is so that when the tree containing the nodes is resized so that some nodes are wider than the visible tree, then I want the clipped text at the end to of the long nodes to be replaced with a visible "...". Stand-alone JLabels will do this automatically, but the JLabel in a DefaultTreeCellRenderer won't. Any suggestions?

Thanks,
Steve Sinai
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the ... seems to work OK like this

 
Steve Sinai
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

I'm afraid in your example the nodes are of a fixed size. I need to be able to change sizes of the nodes dynamically. From what I can tell, you can set the preferred size of a node once, but then once the node is created, you can't change it's size.

Thanks,
Steve
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!