JDK-4719702 : DND of text in JTextArea causes the disappearance of the text
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2002-07-24
  • Updated: 2014-10-16
  • Resolved: 2002-08-01
Related Reports
Duplicate :  
Description
Hopper Build            : 17
OS tested on platforms  :Sparc10(64) and Sparc10(32)
OS build                :  5.10 s10_13 sun4u sparc SUNW,Ultra-5_10

I had tested with 5.10 s10_12 sun4u sparc SUNW,Ultra-5_10 also , and the bug is reproducible.

Java -version:

java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b17)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b17, mixed mode)


Test case to reproduce the bug:

///////////////////////////////////////////////////////////////////////

import javax.swing.*;
import java.awt.*;

           public class Test extends JFrame {

               public Test() {
                   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) {
                   Test t = new Test();
                   t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   t.setSize(400, 400);
                   t.setVisible(true);
               }
           }
////////////////////////////////////////////////////////////////////////

Steps to reproduce:

1. Compile and run the above program.
2. Highlight all of the first line.
3. Begin a drag operation by dragging the text from the first line.
4. Now drop somewhere the text dissapears.


This test passed on Windows-xp and Sparc8.

Also refer the bug 4513715.


###@###.### 2002-07-25

Comments
EVALUATION I am temporarily moving this bug to incomplete. I need more information to evaluate. Please be exact with the description. Please specify the following: 1) Exactly where should I drop the text to see the described behavior? 2) After doing so, what is the exact content of the JTextArea? The drag operation being described is a "MOVE" operation. Therefore, when the text is dropped it should dissapear from its original location and be moved to the drop location. 4513715 describes a bug where the selected text dissapears completely and is not pasted anywhere. ###@###.### 2002-07-24 ////////////////////////////////////////////////////////////////////////////// 1> Drag the First line downwards after highlighting the first line (When this drag operation is performed, we can see that second line is also getting highlighted), drop it to the same position from where it is dragged. 2> After dropping, the second line 'This is some other text.' disappears and hence only first line 'This is the text to drag.' will be present in the text area. ###@###.### 2002-07-25 /////////////////////////////////////////////////////////////////////////////// Thank you for the updated information. I now know what the problem is. This is a result of mouse events being delivered after drag and drop has been initiated. It is potentially reproducible on all platforms and really just depends on how quickly DnD is spun up when it detects a drag operation. If it occurs slowly, it gives a chance for more mouse events to be queued. This is a duplicate of 4613903. Closing as such. ###@###.### 2002-08-01
01-08-2002