In my application I have 2 JTree controls in a JPanel. How can I transfer data between them, so that the items from the source tree are removed.
+1
A:
Write appropriate subclasses of javax.swing.TransferHandler
for both trees. Use TransferHandler.MOVE
as the source action. Override exportDone()
and see if the action includes the MOVE flag. If so, delete the object represented by the Transferable
.
Also see this question: http://stackoverflow.com/questions/1526291/adding-drag-and-drop-support-to-jtree
CarlG
2009-10-30 18:58:07