Example usage for java.awt.dnd DragSource DefaultCopyNoDrop

List of usage examples for java.awt.dnd DragSource DefaultCopyNoDrop

Introduction

In this page you can find the example usage for java.awt.dnd DragSource DefaultCopyNoDrop.

Prototype

Cursor DefaultCopyNoDrop

To view the source code for java.awt.dnd DragSource DefaultCopyNoDrop.

Click Source Link

Document

The default Cursor to use with a copy operation indicating that a drop is currently not allowed.

Usage

From source file:Main.java

public void dragGestureRecognized(DragGestureEvent e) {
    try {// w  w  w .java  2  s .com
        Transferable t = new StringSelection(getText());

        e.startDrag(DragSource.DefaultCopyNoDrop, t, this);
    } catch (InvalidDnDOperationException e2) {
        System.out.println(e2);
    }
}

From source file:MainClass.java

public void dragEnter(DragSourceDragEvent e) {
    System.out.println("Entering drop target #2");

    DragSourceContext ctx = e.getDragSourceContext();

    int action = e.getDropAction();
    if ((action & DnDConstants.ACTION_COPY) != 0)
        ctx.setCursor(DragSource.DefaultCopyDrop);
    else//w  ww .j  ava2s  .c  o m
        ctx.setCursor(DragSource.DefaultCopyNoDrop);
}

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());
            }/* w ww .  j  a  v a2 s  . co  m*/
        }
    }
}