List of usage examples for java.awt.dnd DragSourceDropEvent getDropSuccess
public boolean getDropSuccess()
From source file:DragDropList.java
public void dragDropEnd(DragSourceDropEvent dsde) { if (dsde.getDropSuccess()) { System.out.println("Succeeded"); } else {// w w w .j a v a 2 s.co m System.out.println("Failed"); } }
From source file:DragTest.java
public void dragDropEnd(DragSourceDropEvent dsde) { System.out.print("Drag Drop End: "); if (dsde.getDropSuccess()) { System.out.println("Succeeded"); } else {// www. ja v a2 s.c o m System.out.println("Failed"); } }
From source file:Main.java
public void dragDropEnd(DragSourceDropEvent e) { System.out.println("Drag and drop end"); if (e.getDropSuccess() == false) { System.out.println("unsuccessful"); return;// w ww . jav a 2s.c o m } int action = e.getDropAction(); if ((action & DnDConstants.ACTION_MOVE) != 0) setText(""); }
From source file:DNDList.java
/** * this message goes to DragSourceListener, informing it that the dragging * has ended/*from ww w .j ava2 s . c o m*/ * */ public void dragDropEnd(DragSourceDropEvent event) { if (event.getDropSuccess()) { removeElement(); } }
From source file:JLabelDragSource.java
public void dragDropEnd(DragSourceDropEvent dsde) { DnDUtils.debugPrintln("Drag Source: drop completed, drop action = " + DnDUtils.showActions(dsde.getDropAction()) + ", success: " + dsde.getDropSuccess()); }
From source file:TreeDragTest.java
public void dragDropEnd(DragSourceDropEvent dsde) { /*/* w w w.java2 s. c o m*/ * to support move or copy, we have to check which occurred: */ System.out.println("Drop Action: " + dsde.getDropAction()); if (dsde.getDropSuccess() && (dsde.getDropAction() == DnDConstants.ACTION_MOVE)) { ((DefaultTreeModel) sourceTree.getModel()).removeNodeFromParent(oldNode); } /* * to support move only... if (dsde.getDropSuccess()) { * ((DefaultTreeModel)sourceTree.getModel()).removeNodeFromParent(oldNode); } */ }
From source file:FileTreeDragSource.java
public void dragDropEnd(DragSourceDropEvent dsde) { DnDUtils.debugPrintln("Drag Source: drop completed, drop action = " + DnDUtils.showActions(dsde.getDropAction()) + ", success: " + dsde.getDropSuccess()); // If the drop action was ACTION_MOVE, // the tree might need to be updated. if (dsde.getDropAction() == DnDConstants.ACTION_MOVE) { final File[] draggedFiles = dragFiles; final TreePath[] draggedPaths = paths; Timer tm = new Timer(200, new ActionListener() { public void actionPerformed(ActionEvent evt) { // Check whether each of the dragged files exists. // If it does not, we need to remove the node // that represents it from the tree. for (int i = 0; i < draggedFiles.length; i++) { if (draggedFiles[i].exists() == false) { // Remove this node DefaultMutableTreeNode node = (DefaultMutableTreeNode) draggedPaths[i] .getLastPathComponent(); ((DefaultTreeModel) tree.getModel()).removeNodeFromParent(node); }// ww w. j av a2 s .c o m } } }); tm.setRepeats(false); tm.start(); } }
From source file:ScribbleDragAndDrop.java
/** * This method, and the four unused methods that follow it implement the * DragSourceListener interface. dragDropEnd() is invoked when the user * drops the scribble she was dragging. If the drop was successful, and if * the user did a "move" rather than a "copy", then we delete the dragged * scribble from the list of scribbles to draw. *///from w w w . j av a 2 s . c o m public void dragDropEnd(DragSourceDropEvent e) { if (!e.getDropSuccess()) return; int action = e.getDropAction(); if (action == DnDConstants.ACTION_MOVE) { scribbles.remove(beingDragged); beingDragged = null; repaint(); } }
From source file:unikn.dbis.univis.navigation.tree.VTree.java
/** * This method is invoked to signify that the Drag and Drop * operation is complete. The getDropSuccess() method of * the <code>DragSourceDropEvent</code> can be used to * determine the termination state. The getDropAction() method * returns the operation that the drop site selected * to apply to the Drop operation. Once this method is complete, the * current <code>DragSourceContext</code> and * associated resources become invalid.//from w ww . ja va2 s. c om * * @param dsde the <code>DragSourceDropEvent</code> */ public void dragDropEnd(DragSourceDropEvent dsde) { if (dsde.getDropSuccess()) { if (LOG.isDebugEnabled()) { LOG.debug("Drag and drop finished successfully. The tree UI will be updated."); } updateUI(); } }