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


Java DropTargetDropEvent类代码示例

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


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

示例1: end

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
void end(EventObject e, boolean clear) {
    Point pt = (e instanceof MouseEvent) ? ((MouseEvent)e).getPoint() : ((DropTargetDropEvent)e).getLocation();
    started = false;
    currentItem = null;
    if(dragComponent == null) return;
    if ((e instanceof DropTargetDropEvent)
            || ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
        menuEditLayer.layers.remove(dragComponent);
        menuEditLayer.dropTargetLayer.clearDropTarget();
    }
    
    switch (op) {
    case PICK_AND_PLOP_FROM_PALETTE: completePickAndPlopFromPalette(pt, clear); break;
    case INTER_MENU_DRAG: completeInterMenuDrag(pt); break ;
    case NO_MENUBAR: /* do nothing */ break;
    }
    
    menuEditLayer.glassLayer.requestFocusInWindow();
    if ((e instanceof DropTargetDropEvent)
            || ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
        payloadComponent = null;
        targetComponent = null;
    }
    menuEditLayer.repaint();
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DragOperation.java

示例2: 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

示例3: 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

示例4: drop

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    dtde.acceptDrop(DnDConstants.ACTION_COPY);
    try {
        Transferable t = dtde.getTransferable();
        DataFlavor[] dataFlavors = t.getTransferDataFlavors();
        for (DataFlavor df : dataFlavors) {
            if (df.isFlavorJavaFileListType()) {
                File[] filesArray = (File[]) ((List<File>) t.getTransferData(df)).toArray();
                pathNameTextField.setText(getFilesName(filesArray));
            }
        }
    } catch (UnsupportedFlavorException e2) {
    } catch (IOException ex) {
        Logger.getLogger(SubtitleDownloaderUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:atulgpt,项目名称:SubtitleDownloader,代码行数:18,代码来源:SubtitleDownloaderUI.java

示例5: 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

示例6: handleDrop

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public boolean handleDrop(DropTargetDropEvent e) throws Exception
{
	List<File> files = DnDUtils.getDroppedNativeFiles(e.getTransferable());
	try
	{
		FileInfo dir = fileList.getFileUnderMouseCursor();
		if( dir == null || !dir.isDirectory() )
		{
			dir = fileList.getCurrentDirectory();
		}

		uploadFiles(dir, files.toArray(new File[files.size()]));
		return true;
	}
	catch( Exception ex )
	{
		ex.printStackTrace();
		return false;
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:UploadAction.java

示例7: drop

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
/**
 * 
 * @param e
 */
public void drop(DropTargetDropEvent e)
{
	if (canImport)
	{
		mxGraphTransferHandler handler = getGraphTransferHandler(e);
		MouseEvent event = createEvent(e);

		// Ignores the event in mouseReleased if it is
		// handled by the transfer handler as a drop
		if (handler != null && !handler.isLocalDrag())
		{
			event.consume();
		}

		mouseReleased(event);
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:22,代码来源:mxGraphHandler.java

示例8: 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

示例9: 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

示例10: drop

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
    if (checkDropValid()) {
        int action = dtde.getDropAction();
        
        ProjectHandler project = ProjectHandler.getInstance();
        if (action == DnDConstants.ACTION_MOVE) {
            project.removeNodeFromParent(incomingNode);
        } else if (action == DnDConstants.ACTION_COPY) {
            incomingNode = incomingNode.copy();
        }
        
        project.insertNodeInto(incomingNode, targetNode, 0);
        expandPath(path);
        selectionModel.setSelectionPath(path.pathByAddingChild(incomingNode));

        dtde.acceptDrop(action);
    } else {
        dtde.rejectDrop();
    }
    
    finishDnD();
}
 
开发者ID:m-lima,项目名称:KATscans,代码行数:24,代码来源:DraggableTree.java

示例11: 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

示例12: drop

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public synchronized void drop(DropTargetDropEvent event) {
	event.acceptDrop(DnDConstants.ACTION_COPY);
	try {
		@SuppressWarnings("unchecked")
		List<File> droppedFiles = (List<File>) event.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
		
		int count = droppedFiles.size();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < droppedFiles.size(); i++) {
			sb.append(droppedFiles.get(i));
			
			if (i != count-1) {
				sb.append("|");
			}
		}
		
		target.setText(sb.toString());
		
	} catch (UnsupportedFlavorException | IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:Emd4600,项目名称:SporeModder,代码行数:25,代码来源:AdvancedFileChooser.java

示例13: drop

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
public synchronized void drop(DropTargetDropEvent event) {
	event.acceptDrop(DnDConstants.ACTION_COPY);
	try {
		@SuppressWarnings("unchecked")
		List<File> droppedFiles = (List<File>) event.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
		
		int count = droppedFiles.size();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < droppedFiles.size(); i++) {
			sb.append(droppedFiles.get(i));
			
			if (i != count-1) {
				sb.append("|");
			}
		}
		
		target.setText(sb.toString());
		
	} catch (UnsupportedFlavorException | IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:Emd4600,项目名称:SporeModder,代码行数:24,代码来源:DropTargetTextField.java

示例14: initDnD

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
private void initDnD()
{
   TreeDnDHandlerCallback treeDnDHandlerCallback = new TreeDnDHandlerCallback()
   {
      @Override
      public boolean nodeAcceptsKids(DefaultMutableTreeNode selNode)
      {
         return onNodeAcceptsKids(selNode);
      }

      @Override
      public void dndExecuted()
      {
         onDndExecuted();
      }

      @Override
      public ArrayList<DefaultMutableTreeNode> createPasteTreeNodesFromExternalTransfer(DropTargetDropEvent dtde, TreePath targetPath)
      {
         return onCreatePasteTreeNodesFromExternalTransfer(dtde, targetPath);
      }
   };

   new TreeDnDHandler(_dialog.treFiles, treeDnDHandlerCallback, true);
}
 
开发者ID:realxujiang,项目名称:bigtable-sql,代码行数:26,代码来源:RecentFilesController.java

示例15: onCreatePasteTreeNodesFromExternalTransfer

import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
private ArrayList<DefaultMutableTreeNode> onCreatePasteTreeNodesFromExternalTransfer(DropTargetDropEvent dtde, TreePath targetPath)
{
   List<File> files = DropedFileExtractor.getFiles(dtde, _app);

   ArrayList<DefaultMutableTreeNode> ret = new ArrayList<DefaultMutableTreeNode>();

   DefaultMutableTreeNode parent = findParent(targetPath);
   for (File file : files)
   {
      if (false == parentContainsFile(parent, file))
      {
         ret.add(new DefaultMutableTreeNode(file));
      }
   }

   return ret;

}
 
开发者ID:realxujiang,项目名称:bigtable-sql,代码行数:19,代码来源:RecentFilesController.java


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