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

SwingUtilities.isXMouseButton behaves unexpectedly starting from JDK8 b08

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b27
    • CPU:
      generic
    • OS:
      solaris
    • Verification:
      Verified

      Description

      After #7088744 was fixed 3 JCK tests started to fail.

      The following mini test reproduces the unexpected behavior:

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

      public class Test {

          public static void main(String[] args) throws Exception {

              Component comp = new Canvas();
              MouseEvent event = new MouseEvent(comp, 0, 0, MouseEvent.BUTTON1_MASK,
                      0, 0, 0, false);

              if (SwingUtilities.isLeftMouseButton(event)) {
                  System.out.println("OK");
              } else {
                  System.out.println("Failed. Reported as not left mouse button");
              }
          }
      }

      -------------------------------------------------------------------------------


      JCK8 b02
      JDK8 b08+
      Configuration: JCK-runtime MultiJVM 64bit client, -Xcomp -Xbatch, sound (on Solaris 11 express), printer, headless
      Platform: Solaris i586 10 (jck)


      api/javax_swing/SwingUtilities/descriptions.html#MouseEvent[SwingUtilities2062]
      api/javax_swing/SwingUtilities/descriptions.html#MouseEvent[SwingUtilities2063]
      api/javax_swing/SwingUtilities/descriptions.html#MouseEvent[SwingUtilities2064]

      The output is:

      SwingUtilities2062: Failed. Method isLeftMouseButton returns false
      SwingUtilities2063: Failed. Method isMiddleMouseButton returns false
      SwingUtilities2064: Failed. Method isRightMouseButton returns false
      Also affected:

      api/javax_swing/plaf/basic/BasicButtonListener/index.html#public[BasicButtonListener0002]
      api/javax_swing/plaf/basic/BasicButtonListener/index.html#public[BasicButtonListener0003]

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              alexsch Alexandr Scherbatiy
              Reporter:
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: