/** Called by the system when a drag gesture starts */ @Override public void dragGestureRecognized(DragGestureEvent dge) { dragIndices = getSelectedIndices(); if (dragIndices.length > 0) { List<T> items = getModel().getElementsAt(dragIndices); Transferable stuff = new DnDListItemsTransferable<T>(items); movingItems = true; src.startDrag(dge, DragSource.DefaultMoveDrop, stuff, this); } }
ds.startDrag(dge, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR), transferable, this);
@Override public void dragGestureRecognized(DragGestureEvent event) { theLogger.debug("source dragGestureRecognized"); dragSource.startDrag(event, DragSource.DefaultMoveDrop, this, this); }
public void dragGestureRecognized(final DragGestureEvent dge) { final StringSelection transferable = new StringSelection(Integer.toString(list.getSelectedIndex())); ds.startDrag(dge, DragSource.DefaultCopyDrop, transferable, this); }
public void dragGestureRecognized(DragGestureEvent dge) { StringSelection transferable = new StringSelection(Integer.toString(list.getSelectedIndex())); ds.startDrag(dge, DragSource.DefaultCopyDrop, transferable, this); }
/** * a drag gesture has been initiated * */ public void dragGestureRecognized( DragGestureEvent event) { TreePath tp=this.getSelectionPath(); if (tp!=null){ DefaultMutableTreeNode selected =(DefaultMutableTreeNode) tp.getLastPathComponent(); if ( selected != null ){ StringSelection text = new StringSelection( ""); this.nodeInTransfer=selected; // as the name suggests, starts the dragging dragSource.startDrag (event, DragSource.DefaultMoveDrop, text, this); } else { } } }
public void dragGestureRecognized(DragGestureEvent event) { try { createDragImage(event); dragSource.startDrag(event, delegate.xjTreeDragSourceDefaultCursor(this), dragImage, new Point(5,5), (Transferable)getSelectedNode().getUserObject(), this); } catch(Exception e) { // Ignore currently } }
public void dragGestureRecognized(DragGestureEvent e) { FavoritesNode dragNode = getSelectedNode(); if (dragNode != null) { ghostImage = createGhostImage(e); Transferable transferable = (Transferable) dragNode.getUserObject(); hashCandidate = (Map.ID)dataMap.get((FavoritesItem)transferable); Cursor cursor = DragSource.DefaultCopyDrop; int action = e.getDragAction(); if(action == DnDConstants.ACTION_MOVE){ debug("action move"); cursor = DragSource.DefaultMoveDrop; } dragSource.startDrag(e,dndCursor,ghostImage,new Point(5,5), transferable,this); } }
/** * A DragGestureRecognizer has detected a platform-dependent drag initiating gesture. * It is notifying this listener in order for it to initiate the action for the user. * @param event The DragGestureEvent describing the gesture that has just occurred. */ public void dragGestureRecognized (DragGestureEvent event) { Component component; String cls; Filter filter; StringSelection text; component = event.getComponent (); try { cls = component.getName (); // (String)Filter.mWrappers.get (component.getName ()); if (null != cls) { filter = Filter.instantiate (cls); text = new StringSelection (Filter.deconstitute (new Filter[] { filter })); mDragSource.startDrag (event, DragSource.DefaultMoveDrop, text, this); } } catch (Exception e) { e.printStackTrace (); } }
dragSource.startDrag(
public void dragGestureRecognized(DragGestureEvent dge) { TreePath path = sourceTree.getSelectionPath(); if ((path == null) || (path.getPathCount() <= 1)) { return; } dt = new TreeDropTarget(sourceTree, eventController, path); source.startDrag(dge, DragSource.DefaultLinkDrop, dt, this); }
public final void dragGestureRecognized(DragGestureEvent dge) { TreePath path = tree.getSelectionPath(); if (path != null) { draggedNode = (DefaultMutableTreeNode)path.getLastPathComponent(); draggedNodeParent = (DefaultMutableTreeNode)draggedNode.getParent(); if (drawImage) { Rectangle pathBounds = tree.getPathBounds(path); //getpathbounds of selectionpath JComponent lbl = (JComponent)tree.getCellRenderer().getTreeCellRendererComponent(tree, draggedNode, false , tree.isExpanded(path),((DefaultTreeModel)tree.getModel()).isLeaf(path.getLastPathComponent()), 0,false);//returning the label lbl.setBounds(pathBounds);//setting bounds to lbl image = new BufferedImage(lbl.getWidth(), lbl.getHeight(), java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE);//buffered image reference passing the label's ht and width Graphics2D graphics = image.createGraphics();//creating the graphics for buffered image graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); //Sets the Composite for the Graphics2D context lbl.setOpaque(false); lbl.paint(graphics); //painting the graphics to label graphics.dispose(); } dragSource.startDrag(dge, DragSource.DefaultMoveNoDrop , image, new Point(0,0), new TransferableNode(draggedNode), this); } }
/** * Called by the system when a drag gesture starts */ @Override public void dragGestureRecognized(DragGestureEvent dge) { dragIndices = getSelectedIndices(); if (dragIndices.length > 0) { List<T> items = getModel().getElementsAt(dragIndices); Transferable stuff = new DnDListItemsTransferable<T>(items); movingItems = true; src.startDrag(dge, DragSource.DefaultMoveDrop, stuff, this); } }
public void dragGestureRecognized(DragGestureEvent dge) { if (!controller.isDNDSupported()) { return; } TreePath[] paths = sourceTree.getSelectionPaths(); // If an empty selection is 'being dragged' if (paths == null) { return; } ArrayList nodeList = new ArrayList(); for (TreePath path : paths) { // If the root node 'being dragged' if (path.getPathCount() > 1) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); Node associatedNode = getDomNodeFromTreeNode(node); if (associatedNode != null) { nodeList.add(associatedNode); } } } if (nodeList.isEmpty()) { return; } transferable = new TransferableTreeNode(new TransferData(nodeList)); // Sets the default cursor behavior source.startDrag(dge, null, transferable, this); }
public void dragGestureRecognized(DragGestureEvent dge) { if (!controller.isDNDSupported()) { return; } TreePath[] paths = sourceTree.getSelectionPaths(); // If an empty selection is 'being dragged' if (paths == null) { return; } ArrayList nodeList = new ArrayList(); for (int i = 0; i < paths.length; i++) { TreePath path = paths[i]; // If the root node 'being dragged' if (path.getPathCount() > 1) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); Node associatedNode = getDomNodeFromTreeNode(node); if (associatedNode != null) { nodeList.add(associatedNode); } } } if (nodeList.isEmpty()) { return; } transferable = new TransferableTreeNode(new TransferData(nodeList)); // Sets the default cursor behavior source.startDrag(dge, null, transferable, this); }
LocalManifestAdapter localManifestAdapter = new LocalManifestAdapter(dragContent); awtDragSource.startDrag(trigger, java.awt.Cursor.getDefaultCursor(), null, null, localManifestAdapter, new DragSourceListener() { @Override
LocalManifestAdapter localManifestAdapter = new LocalManifestAdapter(dragContent); awtDragSource.startDrag(trigger, java.awt.Cursor.getDefaultCursor(), null, null, localManifestAdapter, new DragSourceListener() { @Override
int x = image.getWidth() / 2; int y = image.getHeight() / 2; ds.startDrag(dge, Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR), image, new Point(x, y), transferable, this);
DragSource.getDefaultDragSource().startDrag(event, null, new TransferableFileSet(draggedFiles), this);