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

Extended Modifiers on Mouse Events are wrong

XMLWordPrintable

    • x86
    • windows_2000

      J2SE Version (please include all output from java -version flag):
       java version "1.6.0-ea"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b47)
        Java HotSpot(TM) Client VM (build 1.6.0-ea-b47, mixed mode, sharing)

      Does this problem occur on J2SE 1.4.x or 5.0.x ? Yes / No (pick one)
        Yes

      Operating System Configuration Information (be specific):
        Microsoft Windows 2000 [Version 5.00.2195]

      Hardware Configuration Information (be specific):
        Pentium 4

      Bug Description:
       Extended Modifiers on Mouse Events are wrong

      Following the steps produces the following Mouse Events:
      java.awt.event.MouseEvent[MOUSE_ENTERED,(450,343),button=0,clickCount=0]
      on Test$2[...]
      java.awt.event.MouseEvent[MOUSE_PRESSED,(329,251),button=1,modifiers=Button1,extModifiers=Button1,clickCount=1]
      on Test$2[...]
      java.awt.event.MouseEvent[MOUSE_RELEASED,(329,251),button=1,modifiers=Button1,clickCount=1]
      on Test$2[...]
      java.awt.event.MouseEvent[MOUSE_EXITED,(329,251),button=1,modifiers=Button1,extModifiers=Button1,clickCount=1]
      on Test$2[...]
      java.awt.event.MouseEvent[MOUSE_ENTERED,(329,251),button=1,modifiers=Button1,extModifiers=Button1,clickCount=1]
      on null.glassPane

      The extended modifiers of the last 2 mouse events (after the Mouse
      Button was Released) claim that the Button1 is still down.
      Either these 2 events should come before the MOUSE_RELEASED event, or
      the extended modifiers should not say that the Button1 is down, either
      way something is wrong here.

      Steps to Reproduce (be specific):
      1) Run the code below
      2) Press the Button

      import java.awt.event.*;
      import static java.lang.System.*;
      import static javax.swing.JFrame.*;
      import javax.swing.*;

      public class Test {
        public static void main(String[] args) {
          final JFrame frame = new JFrame();
          frame.add(new JButton(new AbstractAction("Test") {
            public void actionPerformed(ActionEvent anEvent) {
              frame.getGlassPane().setVisible(true);
            }
          }) {
            public void processMouseEvent(MouseEvent anEvent) {
              out.println(anEvent);
              super.processMouseEvent(anEvent);
            }
          });
          frame.getGlassPane().addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent anEvent) {
              out.println(anEvent);
            }

            public void mousePressed(MouseEvent anEvent) {
              out.println(anEvent);
            }

            public void mouseReleased(MouseEvent anEvent) {
              out.println(anEvent);
            }

            public void mouseEntered(MouseEvent anEvent) {
              out.println(anEvent);
            }

            public void mouseExited(MouseEvent anEvent) {
              out.println(anEvent);
            }
          });
          frame.setSize(500, 500);
          frame.setVisible(true);
          frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
        }
      }

            bagiras Oleg Pekhovskiy (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: