List of usage examples for java.awt.dnd DragGestureEvent startDrag
public void startDrag(Cursor dragCursor, Transferable transferable, DragSourceListener dsl) throws InvalidDnDOperationException
From source file:Main.java
public void dragGestureRecognized(DragGestureEvent e) { try {// w w w . j a va 2 s. com Transferable t = new StringSelection(getText()); e.startDrag(DragSource.DefaultCopyNoDrop, t, this); } catch (InvalidDnDOperationException e2) { System.out.println(e2); } }
From source file:JLabelDragSource.java
public void dragGestureRecognized(DragGestureEvent dge) { if (DnDUtils.isDebugEnabled()) { DnDUtils.debugPrintln("Initiating event is " + dge.getTriggerEvent()); DnDUtils.debugPrintln("Complete event set is:"); Iterator iter = dge.iterator(); while (iter.hasNext()) { DnDUtils.debugPrintln("\t" + iter.next()); }/*w ww.j a v a2s. c om*/ } Transferable transferable = new JLabelTransferable(label); dge.startDrag(null, transferable, this); }
From source file:de.tor.tribes.ui.algo.AttackTimePanel.java
@Override public void dragGestureRecognized(DragGestureEvent dge) { TimeSpan span = null;/*from w ww .jav a2s. co m*/ if (dge.getComponent().equals(jLabel5)) { span = getSendSpan(); } else if (dge.getComponent().equals(jLabel6)) { span = getArriveSpan(); } if (span != null) { dge.startDrag(null, new StringSelection(span.toPropertyString()), this); } }
From source file:FileTreeDragSource.java
public void dragGestureRecognized(DragGestureEvent dge) { // Get the mouse location and convert it to // a location within the tree. Point location = dge.getDragOrigin(); TreePath dragPath = tree.getPathForLocation(location.x, location.y); if (dragPath != null && tree.isPathSelected(dragPath)) { // Get the list of selected files and create a Transferable // The list of files and the is saved for use when // the drop completes. paths = tree.getSelectionPaths(); if (paths != null && paths.length > 0) { dragFiles = new File[paths.length]; for (int i = 0; i < paths.length; i++) { String pathName = tree.getPathName(paths[i]); dragFiles[i] = new File(pathName); }//from w w w . j av a2 s. c o m Transferable transferable = new FileListTransferable(dragFiles); dge.startDrag(null, transferable, this); } } }
From source file:org.kuali.test.ui.components.repositorytree.RepositoryTree.java
@Override public void dragGestureRecognized(DragGestureEvent event) { if (getSelectionPath() != null) { DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) getSelectionPath() .getLastPathComponent(); if (isSuiteTest(selectedNode)) { TestSuite testSuite = (TestSuite) getParentUserObject(selectedNode); if (testSuite != null) { event.startDrag(DragSource.DefaultCopyNoDrop, new RepositoryTransferable<TestSuite, SuiteTest>( new RepositoryTransferData(testSuite, selectedNode.getUserObject()), DndHelper.getTestOrderDataFlavor()), new RepositoryDragSourceAdapter()); }/*from w w w . j ava 2 s. c o m*/ } } }
From source file:org.rdv.ui.DataPanelContainer.java
public void dragGestureRecognized(DragGestureEvent e) { e.startDrag(DragSource.DefaultMoveDrop, new StringSelection(""), this); }