我遇到以下代码的问题。基本上我有一个JTable。当我移动一行时,它会转到下面的方法,然后:
e.dropComplete(importer.importData(c, t));
我收到一条错误,上面写着Exceptionjava.lang.IndexOutOfBoundsException: Invalid index
public void drop(DropTargetDropEvent e) {
//System.out.println("DropHandler.drop(x)");
int dropAction = e.getDropAction();
JComponent c = (JComponent) e.getDropTargetContext().getComponent();
HookAndEyeTransferHandler importer =
(HookAndEyeTransferHandler) c.getTransferHandler();
if (canImport && importer != null && actionSupported(dropAction)) {
e.acceptDrop(dropAction);
try {
Transferable t = e.getTransferable();
importer.setDropPoint(e.getLocation());
importer.setDropComponent(c);
e.dropComplete(importer.importData(c, t));
} catch (RuntimeException re) {
e.dropComplete(false);
}
} else {
e.rejectDrop();
}
}
行移动但重复。如何将其编码为而不是复制已删除的数据?