0

我对以下代码有疑问。基本上我有一个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();
        }
    }

行移动但重复。如何对其进行编码以重复删除的数据?

4

0 回答 0