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

[macosx] clicking on a tooltip does not dispatch a MouseReleased event.

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_112"
      Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Darwin Alans-iMac 16.1.0 Darwin Kernel Version 16.1.0: Wed Oct 19 20:31:56 PDT 2016; root:xnu-3789.21.4~4/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      When clicking on a tooltip, the mouse pressed event causes the tooltip to be dismissed. The mouse released event should be dispatched to the component(s) under the mouse pointer. However, no mouse released event is dispatched.

      The following comment in LWWindowPeer may explain the cause:

      // TODO: currently, mouse released event goes to the same component
      // that received corresponding mouse pressed event. For most cases,
      // it's OK, however, we need to make sure that our behavior is consistent
      // with 1.6 for cases where component in question have been
      // hidden/removed in between of mouse pressed/released events.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run test program. Move mouse over window and wait for a tool tip to be displayed. Click on the tooltip.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The tooltip should be dismissed and the program should beep in response to receiving a MouseReleased event.
      ACTUAL -
      The tooltip is dismissed, but no beep.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.awt.Toolkit;
      import java.awt.event.MouseAdapter;
      import java.awt.event.MouseEvent;
      import javax.swing.JFrame;
      import javax.swing.JPanel;

      public class Test
      {
      public static void main(String[] args)
      {
      PrimaryFrame w = new PrimaryFrame();
      w.setBounds(100, 100, 400, 400);
      w.setVisible(true);
      }
      }

      class PrimaryFrame extends JFrame
      {
      public PrimaryFrame()
      {
      JPanel top = (JPanel) getContentPane();
      top.setToolTipText("Click on me!");
      top.addMouseListener(new MouseAdapter()
      {
      @Override
      public void mouseReleased(MouseEvent e)
      {
      Toolkit.getDefaultToolkit().beep();
      }
      });
      }
      }

      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: