i want to add drag and drop support to my JTree application
i hav a created a custom DefaultMutableTreeNode subclass
hav a default TreeCellRenderer
what all things do i need to add and where?
i want to add drag and drop support to my JTree application
i hav a created a custom DefaultMutableTreeNode subclass
hav a default TreeCellRenderer
what all things do i need to add and where?
The easiest way is to
1. Call tree.setDragEnabled(true)
2. set tree.transferHandler
There's a tutorial at: http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html
You create a subclass of TransferHandler where you implement
canImport(JComponent comp, DataFlavor[] transferFlavors)
and
importData(JComponent comp, Transferable t)
Thanks
I tried making a custom TreeTransferHandler by extending TransferHandler
But couldn't make good in the direction I wanted
My objective is to be able to transfer TreePath.class instances within a JTree
a code snippet to show the working and application of the TransferHandler should help me
And again thanks for responding to my query