MOUSE_DRAGGED is not generated when a drag is initiated on TextArea

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P5
    • None
    • Affects Version/s: 1.3.1
    • Component/s: client-libs
    • generic
    • solaris_2.6

      The MOUSE_DRAGGED events are not generated on a TextArea/TextField
      when a drag is initiated. This happens since the underlying widgets
      of TextArea and TextField have built-in drag source support. This
      support is not disabled in JDK 1.3.1 on win/solaris.

      Here is the documentation evidence that the MOUSE_DRAGGED events need
      to be generated:

      TextArea has an addMouseMotionListener() method, which it inherits from
      Component.
      The documentation for the MouseMotionListener interface states that the
      mouseDragged() method is "Invoked when a mouse button is pressed on a component
      and then dragged. Mouse drag events will continue to be delivered to the
      component where the first originated until the mouse button is released
      (regardless of whether the mouse position is within the bounds of the
      component)."

      This bug has already been fixed in JDK 1.4 and should be closed
      as integrated in 1.4. This bug was filed to exclude the appropriate
      JCK test from JDK 1.3.1 since Apple hits a similar problem in
      their implementation.

      The test case below demonstartes that events aren't delivered when
      a drag is initiated over the TextArea in JDK 1.3.1 (versus JDK 1.4)

      import java.awt.*;
      import java.awt.event.*;

      public class TextAreaTest implements MouseListener, MouseMotionListener{
          public TextAreaTest() {}

          public static void main(String[] args) {
              Frame f = new Frame("TextAreaTest");
              f.setLayout(new GridLayout(0,1));
              TextArea ta = new TextArea("some text\nsome more text");
              TextAreaTest tat = new TextAreaTest();
              ta.addMouseListener(tat);
              ta.addMouseMotionListener(tat);
              f.add(ta);
              f.add(new Button("Button"));
              f.setSize(300, 300);
              f.show();
          }

          public void mousePressed(MouseEvent e) {
              System.out.println("mousePressed");
          }
          public void mouseReleased(MouseEvent e) {
              System.out.println("mouseReleased");
          }
          public void mouseClicked(MouseEvent e) {
              System.out.println("mouseClicked");
          }
          public void mouseEntered(MouseEvent e) {
              System.out.println("mouseEntered");
          }
          public void mouseExited(MouseEvent e) {
              System.out.println("mouseExited");
          }
          public void mouseDragged(MouseEvent e) {
              System.out.println("mouseDragged");
          }
          public void mouseMoved(MouseEvent e) {
          }
      }

            Assignee:
            Eric Hawkes (Inactive)
            Reporter:
            Kirill Soshalskiy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: