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

fp.bugs 3436 Win32 label drag events delivered to panel, unlike Solaris

XMLWordPrintable

    • sparc
    • solaris_2.5

      Category: AWT

      Priority: Medium (Low/Medium/High/Critical)

      JDK version: JDK-1_0-win32-x86.exe

      Platforms: Windows 95 [Version 4.00.950]
      Windows NT version 3.51

      Synopsis
      --------

      Initiate drag in a label and move out to a panel. Incorrect mouse events
      are delivered to the panel.


      Description
      -----------

      This bug occurs on Windows95 and WindowsNT.

      Press the mouse inside of a label component. Then drag the mouse from
      the label to the label's containing panel, and release the mouse in
      the panel. This causes erroneous mouse events to be delivered.

      On Motif the panel doesn't get any events because the label eats all
      of the events. However, on Windows some events from the label are
      delivered to the panel, but not the correct events. The behavior on
      Windows should match Motif, therefore no events should be delivered
      to the panel from the label.


      Test Case
      ---------

      - Compile and run label.java:

      javac label.java
      java label

      - Drag from the label to the panel (press the mouse inside the label,
        drag to the panel, release the mouse).

        As the mouse exits the label and enters the panel, a mouse down event
        is delivered to the panel. Subsequent mouse drag events are also
        delivered to the panel, and when the mouse is released, a mouse up
        event is delivered to the panel.

        The correct behavior would be either:
          * deliver no events to the panel
          * deliver the mouse down immediately when the mouse is pressed, not
            when the mouse enters the panel

      - Drag from the label, over the panel, and back into the label (press
        the mouse inside the label, drag out over the panel and back into
        the label, and then release the mouse inside the label). Now move
        the mouse around inside the panel.

        As the mouse is moved over the panel, mouse drag events are generated
        even though the mouse button is not being held down anymore. The panel
        seems confused as to the state of the mouse.


      Workaround
      ----------

      No workaround.
      ----------
      X-Sun-Data-Type: default
      X-Sun-Data-Description: default
      X-Sun-Data-Name: label.java
      X-Sun-Charset: us-ascii
      X-Sun-Content-Lines: 51


      import java.awt.*;

      class outlinePanel extends Panel {
        public void paint(Graphics g) {
          Component components[] = getComponents();

          g.setColor(getForeground());
          for (int i=0; i<components.length; i++) {
            Point p = components[i].location();
            Dimension d = components[i].size();
            g.drawRect(p.x-1, p.y-1, d.width+1, d.height+1);
          }
        }
      }

      public class label extends Frame {
        public static void main(String argv[]) {
          new label();
        }

        private Label label;
        
        public label() {
          Panel panel = new outlinePanel();
          label = new Label("Label");

          add("Center", panel);
          panel.add(label);

          show();
          Dimension d = preferredSize();
          resize(d.width*2, d.height*2);
          validate();
        }

        public boolean mouseDown(Event e, int x, int y) {
          System.out.println("mouseDown " + x + " " + y);
          return true;
        }
        
        public boolean mouseUp(Event e, int x, int y) {
          System.out.println("mouseUp " + x + " " + y);
          return true;
        }
        
        public boolean mouseDrag(Event e, int x, int y) {
          System.out.println("mouseDrag " + x + " " + y);
          return true;
        }
      }


            tprinzing Tim Prinzing (Inactive)
            bhagen Benjamin Hagen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: