• Post Reply Bookmark Topic Watch Topic
  • New Topic

Labeling JTree nodes

 
Amy Phillips
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have created a JTree of objects and would like each node to be labelled with the objects name rather than the object identifier which is what I currently get. I have called the objects name into a string and thought I could just give this to the Jtree to use but this doesn't seem to be the case. Anyone know why?
 
Joe Gilvary
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amy,
I think if you write your own toString() method for the Requirement class and have it return the value of name you'll get the behavior you seek.
Thanks,
Joe
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!