当前位置: 首页>>代码示例>>Java>>正文


Java DropTargetDropEvent.dropComplete方法代码示例

本文整理汇总了Java中java.awt.dnd.DropTargetDropEvent.dropComplete方法的典型用法代码示例。如果您正苦于以下问题:Java DropTargetDropEvent.dropComplete方法的具体用法?Java DropTargetDropEvent.dropComplete怎么用?Java DropTargetDropEvent.dropComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.dnd.DropTargetDropEvent的用法示例。


在下文中一共展示了DropTargetDropEvent.dropComplete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent e) {
    Collection<? extends ExternalDropHandler> handlers = Lookup.getDefault().lookupAll(ExternalDropHandler.class);
    for (ExternalDropHandler handler : handlers) {
        if (handler.canDrop(e)) {
            e.acceptDrop(DnDConstants.ACTION_COPY);
            boolean dropped = handler.handleDrop(e);
            if(!dropped) {
                continue; //try next ExternalDropHandler
            }
            e.dropComplete(true);
            isDragging = false;
            return;
        }
    }
    orig.drop(e);
    isDragging = false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:QuietEditorPane.java

示例2: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent dtde) {
    boolean res = false;
    try {
        if( isButtonDrag ) {
            if( validateDropPosition() ) {
                res = handleDrop( dtde.getTransferable() );
            }
        } else if( isToolbarDrag ) {
            res = true;
            //taken care of in dragDropEnd()
        }
    } finally {
        dtde.dropComplete(res);
    }
    resetDropGesture();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DnDSupport.java

示例3: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent dtde) {
  if (dtde.getDropTargetContext().getComponent() == theMap) {
    final MouseEvent evt = new MouseEvent(
      theMap,
      MouseEvent.MOUSE_RELEASED,
      System.currentTimeMillis(),
      0,
      dtde.getLocation().x,
      dtde.getLocation().y,
      1,
      false
    );
    theMap.dispatchEvent(evt);
    dtde.dropComplete(true);
  }

  if (scroller.isRunning()) scroller.stop();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:19,代码来源:Map.java

示例4: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent e)
{
    if (dragSource != null)
    {
        e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
        Point p = e.getLocation();
        int targetRow = rowAtPoint(p);

        Object edge = graph.insertEdge(null, null, null,
                dragSource.cell, JTableRenderer.this.cell, "sourceRow="
                        + sourceRow + ";targetRow=" + targetRow);
        graph.setSelectionCell(edge);

        // System.out.println("clearing drag source");
        dragSource = null;
        e.dropComplete(true);
    }
    else
    {
        e.rejectDrop();
    }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:23,代码来源:JTableRenderer.java

示例5: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent e) {
  if (dragSource != null) {
    e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
    Point p = e.getLocation();
    int targetRow = rowAtPoint(p);

    Object edge = graph.insertEdge(null, null, null, dragSource.cell, JTableRenderer.this.cell,
        "sourceRow=" + sourceRow + ";targetRow=" + targetRow);
    graph.setSelectionCell(edge);

    // System.out.println("clearing drag source");
    dragSource = null;
    e.dropComplete(true);
  } else {
    e.rejectDrop();
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:JTableRenderer.java

示例6: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent e)
{
    if (dragSource != null)
    {
        e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
        Point p = e.getLocation();
        int targetRow = rowAtPoint(p);

        Object edge = graph.insertEdge(null, null, null,
                dragSource.cell, JTableRenderer.this.cell, "sourceRow="
                        + sourceRow + ";targetRow=" + targetRow, null);
        graph.setSelectionCell(edge);

        // System.out.println("clearing drag source");
        dragSource = null;
        e.dropComplete(true);
    }
    else
    {
        e.rejectDrop();
    }
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:23,代码来源:JTableRenderer.java

示例7: getString

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
/**
 * Gets the string.
 *
 * @param event
 *            the event
 * @return the string
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 * @throws UnsupportedFlavorException
 *             the unsupported flavor exception
 */
@SuppressWarnings("unchecked")
static String getString(DropTargetDropEvent event) throws IOException, UnsupportedFlavorException {
    String text = null;
    DataFlavor fileList = DataFlavor.javaFileListFlavor;

    if (event.isDataFlavorSupported(fileList)) {
        event.acceptDrop(DnDConstants.ACTION_COPY);
        List<File> list = (List<File>) event.getTransferable().getTransferData(fileList);
        text = list.get(0).getAbsolutePath();
    } else if (event.isDataFlavorSupported(DataFlavor.stringFlavor)) {
        event.acceptDrop(DnDConstants.ACTION_COPY);
        text = (String) event.getTransferable().getTransferData(DataFlavor.stringFlavor);
        if (text.startsWith("file://"))
            text = text.substring(7);
        text = stripSuffix(stripSuffix(text, "\n"), "\r").replaceAll("%20", " ");
    } else {
        event.rejectDrop();
        return null;
    }

    event.dropComplete(text != null);
    return text;
}
 
开发者ID:thorstenwagner,项目名称:ij-ridgedetection,代码行数:35,代码来源:GenericDialogPlus.java

示例8: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    setDragState(null, 0, 0);

    TabDragInfo dragInfo = getDragInfo(dtde.getTransferable());
    if (dragInfo != null) {
        if (dragInfo.tab != null && Utils.contains(dropZone, dtde.getLocation()) && isSnapInAllowed(dragInfo.tab)) {
            dtde.acceptDrop(dtde.getDropAction());
        } else {
            dtde.rejectDrop();
        }
    } else {
        dtde.rejectDrop();
    }

    dtde.dropComplete(true);
}
 
开发者ID:DJVUpp,项目名称:Desktop,代码行数:18,代码来源:JhromeTabbedPaneUI.java

示例9: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent dtde) {
    if ((dtde.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0) {
        // Accept the drop and get the transfer data
        dtde.acceptDrop(dtde.getDropAction());
        Transferable transferable = dtde.getTransferable();
        boolean dropSucceeded = false;

        try {
            window
                    .setCursor(Cursor
                            .getPredefinedCursor(Cursor.WAIT_CURSOR));

            dropSucceeded = dropFile(dtde.getDropAction(), transferable,
                    dtde.getLocation());

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            window.setCursor(Cursor.getDefaultCursor());
            dtde.dropComplete(dropSucceeded);
        }
    } else {
        dtde.dropComplete(false);
    }
}
 
开发者ID:yjgoo,项目名称:pdm-viewer,代码行数:26,代码来源:DropFileLoader.java

示例10: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(final DropTargetDropEvent e) {
    int length = end - start;
    int insertPosition = textComponent.viewToModel(e.getLocation());
    try {
        textComponent.getDocument().remove(start, length);
        if (insertPosition > end) {
            insertPosition -= length;
        } else {
            if (insertPosition >= start) {
                insertPosition = start;
            }
        }
        textComponent.getDocument().insertString(insertPosition, str,
                                                 null);
        textComponent.replaceSelection("");
        textComponent.setCaretPosition(insertPosition + length);

    } catch (final BadLocationException ex) {
    }
    e.dropComplete(true);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:BasicTextUI.java

示例11: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    try {
        final Transferable transferable = dtde.getTransferable();
        if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
            dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
            final List<File> fileList = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
            if (fileList.size() > 0) {
                final OpenProductAction open = new OpenProductAction();
                open.setFiles(fileList.toArray(new File[fileList.size()]));
                dtde.dropComplete(Boolean.TRUE.equals(open.execute()));
            }
        } else {
            dtde.rejectDrop();
        }
    } catch (UnsupportedFlavorException | IOException ignored) {
        dtde.rejectDrop();
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:ProductExplorerTopComponent.java

示例12: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    if (mDragWasAcceptable) {
        dtde.acceptDrop(dtde.getDropAction());
        if (mModel.getDragColumn() != null) {
            dropColumn(dtde);
        } else {
            Row[] rows = mModel.getDragRows();

            if (rows != null && rows.length > 0) {
                dropRow(dtde);
            }
        }
        dtde.dropComplete(true);
    } else if (mAlternateDragDestination != null) {
        UIUtilities.convertPoint(dtde.getLocation(), this, mAlternateDragDestination);
        mAlternateDragDestination.drop(dtde);
    }
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:20,代码来源:Outline.java

示例13: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    //System.out.println("drop(DropTargetDragEvent)");
    if (dtde.getSource() != dropTarget) {
        dtde.rejectDrop();
        panel.setDropLocation(-1, null);
        return;
    }
    Point dropPoint = dtde.getLocation();
    int index = list.locationToIndex(dropPoint);
    boolean dropped = false;
    if (index == -1 || index == draggedIndex) {
        //System.out.println("dropped onto self");
        dtde.rejectDrop();
        panel.setDropLocation(-1, null);
        return;
    }
    dtde.acceptDrop(DnDConstants.ACTION_MOVE);
    //System.out.println("accepted: " + draggedIndex + "/" + index);
    panel.setDropLocation(-1, null);
    panel.moveStep(draggedIndex, index);
    dropped = true;
    dtde.dropComplete(dropped);
}
 
开发者ID:mbraeunlein,项目名称:ExtendedHodoku,代码行数:25,代码来源:ListDragAndDrop.java

示例14: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent dtde) {
    gestureStarted = false;
    if ((dtde.getDropAction() & DnDConstants.ACTION_MOVE) == DnDConstants.ACTION_MOVE) {
        dtde.acceptDrop(DnDConstants.ACTION_MOVE);
        Transferable t = dtde.getTransferable();

        try {
            DBTableInternalFrame iFrame = (DBTableInternalFrame) t
                    .getTransferData(InternalFrameTransferable.DATA_FLAVOR);
            if (iFrame != DBTableInternalFrame.this) {
                JoinLine joinLine = new JoinLine(iFrame, iFrame
                        .getSelectedRow(), DBTableInternalFrame.this,
                        columnsListBox.getSelectedIndex());
                desktop.addJoinLine(joinLine);
                desktop.repaint();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        dtde.dropComplete(true);
    }
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:24,代码来源:DBTableInternalFrame.java

示例15: drop

import java.awt.dnd.DropTargetDropEvent; //导入方法依赖的package包/类
public void drop(DropTargetDropEvent event) {
    int dropAction = event.getDropAction();
    JComponent c = (JComponent) event.getDropTargetContext().getComponent();
    DataObjectTransferHandler transferHandler = (DataObjectTransferHandler) c.getTransferHandler();

    if (canImport && (transferHandler != null) && actionSupported(dropAction)) {
        event.acceptDrop(dropAction);
        try {
            Transferable transferable = event.getTransferable();
            transferHandler.setDropPoint(event.getLocation());
            transferHandler.setDropComponent(c);
            event.dropComplete(transferHandler.importData(c, transferable));
        } catch (RuntimeException e) {
            event.dropComplete(false);
        }
    } else {
        event.rejectDrop();
    }
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:20,代码来源:DataObjectTransferHandler.java


注:本文中的java.awt.dnd.DropTargetDropEvent.dropComplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。