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

Focus on wrong list item after DnD operation

XMLWordPrintable

    • x86
    • linux



      Name: dk106046 Date: 10/20/2003

      OPERATING SYSTEM(S):
      --------------------
      Linux RedHat 7.3 Gnome desktop

      FULL JDK VERSION(S):
      -------------------
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


      ------------

      1. java Test1

      2. Start Drag by selecting List Item 1 and then pressing left mouse button.

      3. Move the drag icon outside of the list to the panel and release the left mouse button.

      4. List Item 1 is still high lighted, but List Item 4 now has the keyboard focus as shown by
      a border appearing around List Item 4.


      This defect can also be reproduced by dragging items from the list using the JCK test
      api/java_awt/interactive/DnDTests.java

      -----------------------------------------------------------------------------

      /*
       * Test1.java
       */
      import javax.swing.*;
      import java.awt.datatransfer.*;
      import java.awt.dnd.*;
      import java.awt.*;
      import java.io.IOException;

      public class Test1
      {
          public static void main(String argv []) {
              Frame f1 = new Frame();
              List dragList = new List();

              dragList.add("List Item 1");
              dragList.add("List Item 2");
              dragList.add("List Item 3");
              dragList.add("List Item 4");

              DragSource dragSource = new DragSource();

              dragSource.createDefaultDragGestureRecognizer(
                  dragList, // Component
                  DnDConstants.ACTION_COPY_OR_MOVE, // actions
                  new dragGL()); // DragGestureListener

              Panel p = new Panel();
              p.add(dragList);
              f1.add(p,"West");

              f1.setSize(300,300);
              f1.setVisible(true);
          }

          static class dragGL implements DragGestureListener {
              public void dragGestureRecognized(DragGestureEvent e) {
                  Component c = e.getComponent();
                  String s = ((List) c).getSelectedItem();

                  e.startDrag(DragSource.DefaultCopyDrop, // cursor
                      new StringSelection(s), // transferable
                      new DragSourceAdapter(){}); // DragSourceListener
              }
          }
      }

      -----------------------------------------------------------------------------

      [This bug is being submitted as a courtesy, in order to maintain uniformity between Sun & IBM JDKs. It has been fixed in IBM JDKs.
      Please contact ###@###.### if you have questions.]
      ======================================================================

            Unassigned Unassigned
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: