Example usage for java.awt.dnd DragSourceContext setCursor

List of usage examples for java.awt.dnd DragSourceContext setCursor

Introduction

In this page you can find the example usage for java.awt.dnd DragSourceContext setCursor.

Prototype


public synchronized void setCursor(Cursor c) 

Source Link

Document

Sets the custom cursor for this drag operation to the specified Cursor .

Usage

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/*from w  w  w . j a  v a2s.  c o  m*/
        ctx.setCursor(DragSource.DefaultCopyNoDrop);
}