當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。