Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Edit node labels in JTree

843806Nov 21 2008 — edited Nov 24 2008
Hello, I have a question about node label editting vs. underlying model data editing.
I have a JTree with my custom TreeDataModel, it works fine and properly displays all entitites (objects) in my "tree-like" data structure.
However, each my entity has overriden toString() to show entity Name + entity Type. For entity Monster is for example "Grishnakh (orc)"
When I try to edit the label of node, I want to edit only Name property. And after editing display Name + Type again.
But when I edit (F2) the node label, in editor there is complete text (Name + Type) and after validating it sets all this string to Name - now my name is "Grishnakh (orc)"
How should I remove type before editing the label?

Thank you.

Talerod
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2008
Added on Nov 21 2008
2 comments
713 views