Selecting text and then dragging and dropping that text within the selected region of the same text component causes the selected text to be clobbered and nothing to be pasted. Such an operation should do nothing.
Try the following test case:
Highlight all of the first line.
Begin a drag operation by dragging the text from the first line.
Now drop somewhere into the original selected region.
The text dissapears.
The expected result is that nothing should happen. The text should not be clobbered.
import javax.swing.*;
import java.awt.*;
public class ClobberTest extends JFrame {
public ClobberTest() {
JTextArea ta = new JTextArea();
ta.append("This is the text to drag.");
ta.append("\nThis is some other text.");
ta.setDragEnabled(true);
getContentPane().add(new JScrollPane(ta));
}
public static void main(String[] args) {
ClobberTest t = new ClobberTest();
t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
t.setSize(400, 400);
t.setVisible(true);
}
}