Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree -> JLabel problem with ellipsis

 
Alexey Pilipchuk
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!
I've got a problem with tree node rendering.
Initially the JTree is constructed and drawn with several bold node titles, lately I need to change a bold font to a normal one but after I do this in the custom renderer all recently bold nodes become cut down with ellipsis. It is very strange coz bold text is supposed to be wider.
I've been searching for the remedy quite a long time but still haven't found anything suitable.
Some advises tree.setLargeModel(true); but it doesn't help.
Is there any reasonable solition to this problem?

Thanks in advance
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a DefaultTreeModel for your tree model, then every time you change the way a node is going to appear, call the model's nodeChanged(TreeNode node) method with that node.
 
Alexey Pilipchuk
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the point is that node's title itself remains the same but changes the font style from bold to normal and back.

I've tryed

but it didn't help.

I suspect the problem is connected somehow with JLabel rendering behaviour.
This is how I implement rederer:


Maybe it's worth implemeting the renderer somehow else not utilizing JLabel?

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!