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

URGENT: no mouse event from a window receiving a drop

XMLWordPrintable

    • kestrel
    • x86, sparc
    • solaris_2.6, windows_nt



      Name: jtC48319 Date: 05/22/98


      when you drag a component from one window
      and drop it into another in ALL previous
      versions you got a mouse enter in the window
      which had the component dropped in it. In
      1.1.6 you get nothing! How can we implement
      dragging between windows if there are no
      events being generated in the window receiving
      the drop at the time of the drop ????

      This is a serious bug of 1.1.6 in solaris.


      jukka@canada 1998-05-22

      Below is additional information and test program provided by the customer.

      Type

      javac MouseEvents.java

      to compile. and

      java MouseEvents

      to run. There are two windows
      one with a grey backgound the other containing a blue
      panel. Try dragging the blue panel over to the grey window
      as if you were going to drop it into the grey window. Notice
      the events which are printed out. For 1.1.6. you never get
      a mouse enter on the frame receiving the drop which is absolutely
      crucial in detecting which window you are dropping a panel
      into. So for example the program outputs the following :-


      In 1.1.3 you get when mouse is being dragged :-

      Panel: MOUSE_PRESSED 189 179
      Panel: MOUSE_DRAGGED 186 180
      Panel: MOUSE_DRAGGED 179 182
      Panel: MOUSE_DRAGGED 168 183
      Panel: MOUSE_DRAGGED 156 183
      Panel: MOUSE_DRAGGED 118 181
      Panel: MOUSE_DRAGGED 78 179
      Panel: MOUSE_DRAGGED 46 175
      Panel: MOUSE_DRAGGED 34 170
      Panel: MOUSE_DRAGGED 2 164
      Panel: MOUSE_EXITED -11 158
      Panel: MOUSE_DRAGGED -21 153
      Panel: MOUSE_DRAGGED -27 149
      Panel: MOUSE_DRAGGED -34 143
      Panel: MOUSE_DRAGGED -39 137
      Panel: MOUSE_DRAGGED -43 133
      Panel: MOUSE_DRAGGED -46 131
      Panel: MOUSE_DRAGGED -51 128
      Panel: MOUSE_DRAGGED -57 126
      Panel: MOUSE_DRAGGED -66 123
      Panel: MOUSE_DRAGGED -74 120
      Panel: MOUSE_DRAGGED -81 117
      Panel: MOUSE_DRAGGED -85 115
      Panel: MOUSE_DRAGGED -86 115
      Panel: MOUSE_DRAGGED -88 115
      Panel: MOUSE_DRAGGED -93 117
      Panel: MOUSE_RELEASED -93 117
      Panel: MOUSE_EXITED -93 117
      frame0: MOUSE_EXITED -88 142
      frame1: MOUSE_ENTERED 212 242


      In 1.1.6 you get :-

      Panel: MOUSE_PRESSED 187 162
      Panel: MOUSE_DRAGGED 186 162
      Panel: MOUSE_DRAGGED 182 162
      Panel: MOUSE_DRAGGED 177 161
      Panel: MOUSE_DRAGGED 174 161
      Panel: MOUSE_DRAGGED 171 161
      Panel: MOUSE_DRAGGED 165 162
      Panel: MOUSE_DRAGGED 160 162
      Panel: MOUSE_DRAGGED 152 162
      Panel: MOUSE_DRAGGED 143 162
      Panel: MOUSE_DRAGGED 134 162
      Panel: MOUSE_DRAGGED 123 162
      Panel: MOUSE_DRAGGED 83 161
      Panel: MOUSE_DRAGGED 49 161
      Panel: MOUSE_DRAGGED 40 160
      Panel: MOUSE_DRAGGED 35 158
      Panel: MOUSE_DRAGGED 28 155
      Panel: MOUSE_DRAGGED 17 153
      Panel: MOUSE_DRAGGED 3 150
      Panel: MOUSE_EXITED -9 147
      Panel: MOUSE_DRAGGED -27 139
      Panel: MOUSE_DRAGGED -34 134
      Panel: MOUSE_DRAGGED -37 131
      Panel: MOUSE_DRAGGED -41 128
      Panel: MOUSE_DRAGGED -45 123
      Panel: MOUSE_DRAGGED -56 116
      Panel: MOUSE_DRAGGED -66 108
      Panel: MOUSE_DRAGGED -76 99
      Panel: MOUSE_DRAGGED -86 92
      Panel: MOUSE_DRAGGED -94 87
      Panel: MOUSE_DRAGGED -97 86
      Panel: MOUSE_DRAGGED -96 86
      Panel: MOUSE_DRAGGED -96 88
      Panel: MOUSE_RELEASED -96 88

      No indication on which window it was dropped onto!

      This must be a bug because it doesn't make sense not to have
      any events for an event as crucial as knowing where something
      has been dropped onto. Also, on the same point on earlier
      releases i.e. 1.1.3 you got a mouse enter on unix machines
      and a mouse move on windows 95 machines. Why were these different?

      I find that event generated are changed on each new release
      of java. The software (Triana) which I've written (see below)
      is 82,000 lines of code which test every possible mouse
      drag, move, click etc. scenario so I can check
      immediately using this software for potential bugs in
      mouse behaviour of new releases of java. Perhaps sun would
      be interested in trying a new release out on me first
      by coming to some kind of arrangement ? Just an idea.

      all the best,

      Ian

      --
      ============================================================
      = Dr Ian Taylor email : ###@###.### =
      = Triana Home Page : http://www.astro.cf.ac.uk/Triana/ =
      = Department of Physics and Astronomy, =
      = University of Wales, College of Cardiff =
      = Telephone : (01222) 874000 ext 5032 =
      = Fax : (01222) 874056 =
      ============================================================

      Test program:
      ----------

      -- cut here -- cut here -- cut here -- cut here -- cut here -- cut here --

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

      public class MouseEvents extends Frame implements MouseListener,
                                                 MouseMotionListener {
          int mode;
          static int WITH_WIDGET = 0;

          public MouseEvents(int mode) {
              super("Window");
              setSize(300,300);

              addMouseListener(this);
              addMouseMotionListener(this);

              if (mode == WITH_WIDGET) {
                  setLayout(new BorderLayout());
                  add("Center", new SimplePanel());
                  }
              }
       
          public void mouseMoved(MouseEvent e) {
              printEvent(e);
              }

          public void mouseDragged(MouseEvent e) {
              printEvent(e);
              }

          public void mouseClicked(MouseEvent e) {
              printEvent(e);
              }

          public void mouseEntered(MouseEvent e) {
              printEvent(e);
              }


          public void mouseExited(MouseEvent e) {
              printEvent(e);
              }
         
          public void mousePressed(MouseEvent e) {
             printEvent(e);
             }

          public void mouseReleased(MouseEvent e) {
             printEvent(e);
             }

          public static void printEvent(MouseEvent e) {
              Component source = e.getComponent();

              String type = "none";
        
              if (e.getID() == MouseEvent.MOUSE_PRESSED)
                  type = "MOUSE_PRESSED";

              if (e.getID() == MouseEvent.MOUSE_CLICKED)
                  type = "MOUSE_CLICKED";

              if (e.getID() == MouseEvent.MOUSE_RELEASED)
                  type = "MOUSE_RELEASED";

              if (e.getID() == MouseEvent.MOUSE_MOVED)
                  type = "MOUSE_MOVED";

              if (e.getID() == MouseEvent.MOUSE_ENTERED)
                  type = "MOUSE_ENTERED";

              if (e.getID() == MouseEvent.MOUSE_ENTERED)
                  type = "MOUSE_ENTERED";

              if (e.getID() == MouseEvent.MOUSE_EXITED)
                  type = "MOUSE_EXITED";


              if (e.getID() == MouseEvent.MOUSE_DRAGGED)
                  type = "MOUSE_DRAGGED";

              System.out.println(source.getName() + ": " + type + " " +
                     e.getX() + " " + e.getY());

              }

          public static void main(String args[]) {
               MouseEvents m = new MouseEvents(MouseEvents.WITH_WIDGET);
               m.setLocation(500, 300);
               m.setVisible(true);
               MouseEvents t = new MouseEvents(MouseEvents.WITH_WIDGET+1);
               t.setLocation(200, 200);
               t.setVisible(true);
               }

         }



      class SimplePanel extends Panel implements MouseListener,
                                                 MouseMotionListener {

          public SimplePanel() {
              super();
              setName("Panel");
              addMouseListener(this);
              addMouseMotionListener(this);
              setSize(100, 100);
              setVisible(true);
              setBackground(Color.blue);
              }
             
          public void mouseMoved(MouseEvent e) {
              printEvent(e);
              }

          public void mouseDragged(MouseEvent e) {
              printEvent(e);
              }

          public void mouseClicked(MouseEvent e) {
              printEvent(e);
              }

          public void mouseEntered(MouseEvent e) {
              printEvent(e);
              }

          public void mouseExited(MouseEvent e) {
              printEvent(e);
              }
         
          public void mousePressed(MouseEvent e) {
             printEvent(e);
             }

          public void mouseReleased(MouseEvent e) {
              printEvent(e);
              }

          public static void printEvent(MouseEvent e) {
              MouseEvents.printEvent(e);
              }
          }
      -- cut here -- cut here -- cut here -- cut here -- cut here -- cut here --
      (Review ID: 30880)
      ======================================================================

            mmartaksunw Michael Martak (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: