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

When doing a drag and drop, the drop event does not have the modifiers set.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 1.4.2
    • client-libs
    • x86
    • windows_2000

      Name: gm110360 Date: 04/13/2004


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

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      When doing a drag and drop, the drop event does not have the modifiers set.

      It is not possible to tell which mouse button the user is holding down when a drag and drop is done. Holding down the left button says button == 0, holding down the right mouse button still says button == 0.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run code
      drag onto the text field with the left mouse button held down
      observe in the console button == 0
      drag onto the text field with the right mouse button held down
      observe in the console button == 0

      (also note getModifiersEx() == 0 in both cases)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the button results to be different in both cases
      ACTUAL -
      the button results are the same

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.datatransfer.*;
      import javax.swing.*;

      public class Test {
        public static void main(String[] args) {
          JFrame frame = new JFrame();
          JTextField textField = new JTextField();
          textField.setTransferHandler(new TransferHandler() {
            public boolean canImport(JComponent aComponent, DataFlavor[] aFlavorArray) {
              System.out.println(EventQueue.getCurrentEvent());
              return super.canImport(aComponent, aFlavorArray);
            }
          });
          frame.getContentPane().add(textField);
          frame.setSize(200, 200);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
        }
      }
      ---------- END SOURCE ----------
      (Incident Review ID: 250057)
      ======================================================================

            Unassigned Unassigned
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: