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

MAJOR! Drag events and mouse released events not delivered if mouse is moved qui

XMLWordPrintable

    • b01
    • generic, x86
    • generic, windows_95, windows_nt
    • Not verified



        Name: mc57594 Date: 02/27/97


        1) In the example given, click in the red area and move the mouse
        out of the red area quickly. Note that DRAG events are not delivered.
        In addition the mouse released event is not delivered when the mouse
        is released. When the red component receives two mouse downs in a row
        without a mouse up it will print ERROR: in the output window.

        2) Source Code: (Stand Alone Example)
        import java.awt.*;
        import java.awt.event.*;

        class DragBug
            extends Panel
        {
                public DragBug()
                {
                    addMouseMotionListener(new IMouseMotionAdapter());
                    addMouseListener(new IMouseAdapter());
                    setBackground(Color.red);
                }

                public Dimension preferredSize()
                {
                    return new Dimension(50,50);

                }


                class IMouseMotionAdapter extends MouseMotionAdapter
                {
                    public IMouseMotionAdapter(){}

                    public void mouseDragged(MouseEvent e)
                    {
                        System.out.println("DragBug: DragEvent");
                    }

                }

                class IMouseAdapter extends MouseAdapter
                {
                     public IMouseAdapter(){}

                     public void mousePressed(MouseEvent e)
                     {
                        System.out.println("DragBug: MousePressed");

                        if (ivHasMouse)
                        {
                            System.out.println("ERROR: Mouse pressed in a row without release!!");
                        }

                        ivHasMouse = true;
                     }

                     public void mouseReleased(MouseEvent e)
                     {
                        System.out.println("DragBug: MouseReleased");
                        ivHasMouse = false;
                     }
                }

                public boolean ivHasMouse = false;

        }


        public class DragBugDemo
        {
                public static void main(String args[])
                {
                    Frame f = new Frame("DragBug");
                    f.setLayout(new FlowLayout());
                    f.add(new DragBug());
                    f.setBounds(new Rectangle(20,20,300,300));
                    f.show();

                }


        }

        3) No error messages. Behvaior BUG

        4) Trace from program. Notice the two mouse pressed events.
        and no drag events.
        DragBug: DragEvent
        DragBug: MouseReleased
        DragBug: MousePressed
        DragBug: MousePressed
        ERROR: Mouse pressed in a row without release!!
        DragBug: MouseReleased
        DragBug: MousePressed
        DragBug: MouseReleased


        5)Plain Win 95
        company - Shafir Inc. , email - ###@###.###
        ======================================================================

              rkhansunw Robi Khan (Inactive)
              mchamnessunw Mark Chamness (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: