Originally posted by Javier Camara:
I'm doing an app that uses a JTree that I want to dinamically change.
I want to move up and down two kind of nodes (all my nodes extends DefaultMutableTreeNode).
If I remove any node, the tree responses fine, using the 'removeNodeFromParent()' as I could see into previous message, but I don't find the way to move the nodes.
There are an up and a down button, that move up/down with the inmediately next/previous node.
I try all the methods of the DefaultTreeModel and little bit combinations of these...
By example:
projectTreeModel().nodeStructureChanged(node1);
projectTreeModel().nodeStructureChanged(node2);
or
Anybody has a suggestion to do this?
You should be ok so long as you only use the methods provided by DefaultTreeModel [
insertNodeInto() and
removeNodeFromParent()] and don't call the nodes' methods directly [so no node1.insert()].
If you're already doing that then I guess we need more details.
[ March 07, 2008: Message edited by: Brian Cole ]