|
Quick Lists
|
|
Bug ID:
|
4513715
|
|
Votes
|
0
|
|
Synopsis
|
JTextComponent: DnD from and to same region clobbers selection & pastes nothing
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
merlin-beta
|
|
Release Fixed
|
1.4.1(hopper)
|
|
State
|
10-Fix Delivered,
Verified,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
|
|
Submit Date
|
11-OCT-2001
|
|
Description
|
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);
}
}
|
|
Work Around
|
N/A
|
|
Evaluation
|
BasicTextUI.TextTransferHandler will now remember when one if its components is the source of the drag operation. If that component is also the target of the drag operation, it will check that the drop region is not inside the drag region. If it is, it will handle it nicely rather than clobbering the text.
xxxxx@xxxxx 2002-04-04
|
|
Comments
|
Submitted On 05-NOV-2002
shankee
good
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |