This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Editable JTree???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Editable JTree????" Watch "Editable JTree????" New topic
Author

Editable JTree????

Vijay Kashyap
Ranch Hand

Joined: Jul 30, 2001
Posts: 74
This is driving me crazy.
I have extended JTree to add Drag Drop Functionality, which is working perfectly. I am using my own TreeModel which is extending DEfaultTreeModel and TreeNode extending DefaultMutableTreeNode.
My problem is that even though I am able to get a textfield as my node editor but any changes to the text are lost once I hit enter, tree nodes display the initial values.
I might be overlooking some basic things, could any body points me how to get a editable tree.
Regards,
Vijay
[ May 30, 2002: Message edited by: vijay kashyap ]
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

I dont think you edit the node as much as you replace it. The treeModel contains the data, so editing the node will make no difference unless you replace the one the TreeModel will be showing, or edit the one the TreeModel will show.
Is your treeModel aware of the new edited node?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Editable JTree????