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

REG: With a lefthanded mouse setup event for mouseDragged reports the wrong butt

    Details

    • Subcomponent:
    • Resolved In Build:
      rc1
    • CPU:
      x86
    • OS:
      windows_2000
    • Verification:
      Verified

      Description



      Name: yyT116575 Date: 07/17/2001


      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)

      MouseEvent object passed to mouseDragged() reference the correct mouse button
      for a standard mouse setup, but the wrong mouse button for a lefthanded setup.
      i.e.Butoons for pressing dragging and releasing the righthand button are:

       pressed:button1, dragged: meta button3, released button1.

      Following code borrowed from another bug report demonstrates this:

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.event.*;

      public class T2 extends JScrollPane implements MouseInputListener {

        private JTextArea jt;

        public T2() {
              super();
          setViewportView(jt = new JTextArea());
          jt.setEditable(false);
          jt.addMouseMotionListener(this);
          jt.addMouseListener(this);
          setPreferredSize(new Dimension(150,100));
        }

        public void mouseMoved (MouseEvent e) { }
        public void mouseClicked (MouseEvent e) { }
        public void mouseReleased(MouseEvent e) {
          int mod = e.getModifiers();
          int button =
              ((mod & MouseEvent.BUTTON1_MASK) != 0) ? 1 :
              ((mod & MouseEvent.BUTTON2_MASK) != 0) ? 2 :
              ((mod & MouseEvent.BUTTON3_MASK) != 0) ? 3 : -1;
          StringBuffer buf = new StringBuffer();
          buf.append("Released ");
          if ((mod & InputEvent.ALT_MASK) != 0) buf.append("Alt ");
          if ((mod & InputEvent.CTRL_MASK) != 0) buf.append("Ctrl ");
          if ((mod & InputEvent.META_MASK) != 0) buf.append("Meta ");
          if ((mod & InputEvent.SHIFT_MASK) != 0) buf.append("Shift ");
          buf.append("Button "+button+"\n");
          jt.append(buf.toString());
          
           }
        public void mouseEntered (MouseEvent e) { }
        public void mouseExited (MouseEvent e) { }
        public void mousePressed (MouseEvent e) {
          int mod = e.getModifiers();
          int button =
              ((mod & MouseEvent.BUTTON1_MASK) != 0) ? 1 :
              ((mod & MouseEvent.BUTTON2_MASK) != 0) ? 2 :
              ((mod & MouseEvent.BUTTON3_MASK) != 0) ? 3 : -1;
          StringBuffer buf = new StringBuffer();
          buf.append("Pressed ");
          if ((mod & InputEvent.ALT_MASK) != 0) buf.append("Alt ");
          if ((mod & InputEvent.CTRL_MASK) != 0) buf.append("Ctrl ");
          if ((mod & InputEvent.META_MASK) != 0) buf.append("Meta ");
          if ((mod & InputEvent.SHIFT_MASK) != 0) buf.append("Shift ");
          buf.append("Button "+button+"\n");
          jt.append(buf.toString());
        }

        public void mouseDragged (MouseEvent e) {
          int mod = e.getModifiers();
          int button =
              ((mod & MouseEvent.BUTTON1_MASK) != 0) ? 1 :
              ((mod & MouseEvent.BUTTON2_MASK) != 0) ? 2 :
              ((mod & MouseEvent.BUTTON3_MASK) != 0) ? 3 : -1;
          StringBuffer buf = new StringBuffer();
          buf.append("Dragged ");
          if ((mod & InputEvent.ALT_MASK) != 0) buf.append("Alt ");
          if ((mod & InputEvent.CTRL_MASK) != 0) buf.append("Ctrl ");
          if ((mod & InputEvent.META_MASK) != 0) buf.append("Meta ");
          if ((mod & InputEvent.SHIFT_MASK) != 0) buf.append("Shift ");
          buf.append("Button "+button+"\n");
          jt.append(buf.toString());
        }
        
        public static final void main(String[] argv) {
          JFrame jf = new JFrame();
          jf.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
            }
          });
          jf.getContentPane().add(new T2(), BorderLayout.CENTER);
          jf.pack();
          jf.setVisible(true);
        }
      }
      (Review ID: 128242)
      ======================================================================

      java version "1.4.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
      Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)

      This problem in bugid: 4449779 and 4471459 is not fixed in Windows
      2000 with jdk1.4-beta2.

      Exact steps to reproduce:
      1)Put the mouse in left handed configuration on Windows 2000
      2)Run the Swing Set demo (%JAVA_HOME%\demo\jfc\SwingSet2\SwingSet2.jar)
      3)Notice that you can't drag internal frames with Mouse Button 1
      (Review ID: 132510)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ssisunw Ssi Ssi (Inactive)
                Reporter:
                yyoungsunw Yung-ching Young (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: