更新时间:2023-02-24 12:56:50
最简单的方法是
1.调用tree.setDragEnabled(true)
2.设置tree.transferHandler
The easiest way is to
1. Call tree.setDragEnabled(true)
2. set tree.transferHandler
在以下位置有一个教程: http://java.sun.com/docs/books/tutorial /uiswing/dnd/intro.html
There's a tutorial at: http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html
您创建要在其中实现的TransferHandler的子类
You create a subclass of TransferHandler where you implement
canImport(JComponent comp, DataFlavor[] transferFlavors)
和
importData(JComponent comp, Transferable t)