Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4712076

Swing DnD: JTextArea caret disappears after dragging text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.1
    • client-libs
    • x86
    • linux



      Name: dk106046 Date: 07/09/2002

      Windows and Linux

      java version "1.4.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
      Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

      and

      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b13)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b13, mixed mode)
         
      Testcase:

      import java.awt.*;
      import javax.swing.*;
      public class DnDTest {
             public static void main(String [] args){
                    new DnDTest();
             }
             public DnDTest(){
                    JFrame f1 = new JFrame("Drag Source");
                    JFrame f2 = new JFrame("Drop Target");
                    JTextArea ta1 = new JTextArea("test");
                    ta1.setDragEnabled(true);
                    JTextArea ta2 = new JTextArea();
                    
                    f1.getContentPane().add(ta1);
                    f2.getContentPane().add(ta2);
                    f1.setSize(200,200);
                    f1.setLocation(10,10);
                    f2.setSize(200,200);
                    f2.setLocation(230,10);

                    f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                    f1.show();
                    f2.show();
                    
             }
      }

      Select the text in the JTextArea named "Drag Source".
      Please make sure that the selected text is highlighted and
      the caret is blinking.

      Drag and drop the selected text onto the other JTextArea named
      "Drop Target" just at the moment that the caret disappears in
      its blinking.

      Move the focus to the Drag Source JTextArea.
      The caret no longer appears in the Drag Source JTextArea.

      The problem is timing related - you may need to try several
      times to reproduce. I think the state of the blinking
      caret is significant at the point you drag the text out of
      the first window. To reproduce on Linux you need a window
      manager set to "click to focus" mode.

      ======================================================================

            agerasimsunw Alexander Gerasimov (Inactive)
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: