• Post Reply Bookmark Topic Watch Topic
  • New Topic

jtree problem  RSS feed

 
Tal Goldstein
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
im trying to change the jtree renderer to do the following:
each node in the tree should be on a panel which contains two lables,
the left label which is the node name and its icon, and the right label which would be a legend.
i already created that and it works,
the problem is that i want the legend label(the right label) to be aligned to the right of the tree, but i cant get it to work because it aligns label to the right of panel, but the panel itself isnt as wide as the tree component.
how can i tell jtree to set each of the nodes panels to be as wide as the jtree itself?

here's how it should look like:http://www16.brinkster.com/talgo/eg.jpg
this is what i get:http://www16.brinkster.com/talgo/current.jpg


thanks

[ April 16, 2006: Message edited by: Tal Goldstein ]
[ April 16, 2006: Message edited by: Tal Goldstein ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this to work with custom TreeCellRenderer and BasicTreeUI classes. The minimum I could get by with in the UI code was this:

and set the ui after the tree was realized (no size data otherwise).
I put this together with the j2se 1.5 sdk and notice (in the docs) that there have been some changes (starting in 1.5).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!