DnDConstants.ACTION_COPY has the following syntax.
public static final int ACTION_COPY
In the following code shows how to use DnDConstants.ACTION_COPY field.
import java.awt.BorderLayout; import java.awt.dnd.DnDConstants; import java.awt.dnd.DragGestureEvent; import java.awt.dnd.DragGestureListener; import java.awt.dnd.DragGestureRecognizer; import java.awt.dnd.DragSource; /*from ww w .j ava 2s . c o m*/ import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; public class Main extends JFrame implements DragGestureListener { DragSource ds = new DragSource(); String[] items = { "Java", "C", "C++", "Lisp", "Perl", "Python" }; JList jl = new JList(items); public Main() { super("Gesture Test"); setSize(200, 150); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); getContentPane().add(new JScrollPane(jl), BorderLayout.CENTER); DragGestureRecognizer dgr = ds.createDefaultDragGestureRecognizer(jl, DnDConstants.ACTION_COPY, this); setVisible(true); } public void dragGestureRecognized(DragGestureEvent dge) { System.out.println("Drag Gesture Recognized!"); } public static void main(String args[]) { new Main(); } }