posted 21 years ago
I just did this method to move the currently selected child node up or down within its parent. It assumes single select mode and tree nodes are (or extend) DefaultMutableTreeNode.
The JTree remove and insert methods do the moving. The rest just make sure it is ok to move.
This always inserts the node in collapsed state. I'd like to find a way to preserve the state of the node I'm moving and all of its children.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi