Edit node labels in JTree
843806Nov 21 2008 — edited Nov 24 2008Hello, 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