JDK-8134917 : [macosx] JOptionPane doesn't receive mouse events when opened from a drop event
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u60
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2015-09-01
  • Updated: 2016-06-02
  • Resolved: 2015-09-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u72Fixed 9 b85Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Darwin mbp.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
Every time some dialog is triggered to open from a drop event. The dialog doesn't receive any mouse events. 

REGRESSION.  Last worked in version 8u51

ADDITIONAL REGRESSION INFORMATION: 
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using the attached example code. Just drop anything into the JFrame. From Finder and some other application.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expecting to be able to click on the JOptionPane buttons. But it doesn't work.
ACTUAL -
The buttons doesn't get any mouse events.

REPRODUCIBILITY :
This bug can be reproduced always.

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

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import java.awt.HeadlessException;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;


public class MainClass extends JFrame implements DropTargetListener
{
    public static void main(String[] args)
    {
        new MainClass();
    }


    public MainClass()
            throws HeadlessException
    {

        new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, this);
        setSize(320, 256);
        setVisible(true);
    }


    @Override
    public void dragEnter(DropTargetDragEvent dtde)
    {
        dtde.acceptDrag(dtde.getDropAction());
    }


    @Override
    public void dragOver(DropTargetDragEvent dtde)
    {
        dtde.acceptDrag(dtde.getDropAction());
    }


    @Override
    public void dropActionChanged(DropTargetDragEvent dtde)
    {
        dtde.acceptDrag(dtde.getDropAction());
    }


    @Override
    public void dragExit(DropTargetEvent dte)
    {
    }


    @Override
    public void drop(DropTargetDropEvent dtde)
    {
        dtde.acceptDrop(dtde.getDropAction());
        JOptionPane.showConfirmDialog(this, "message");
        dtde.dropComplete(true);
    }
}

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


Comments
There is no need to add noreg-* label to the bug because the fix includes the regression test. See the changeset: http://hg.openjdk.java.net/jdk9/client/jdk/rev/34c93fd32c20
22-10-2015

This is the regression from the issue JDK-8068886
23-09-2015

Run the attached test case (MainClass.java) in Mountain Lion (MAC OS X 10.8.5), remote system (slow response). Checked this for JDK 8u51, 8u60 and 9 ea b78. Result: ============= 8u51: OK 8u60: Partial 9 ea b78: OK Steps to reproduce: =============== 1. Compile and run the attached program 2. Drop any file from Finder to the JFrame 3. Click on the buttons in the dialog (Cancel, No or Yes) Unable to reproduce this issue consistently. Clicked on Yes/No button and was able to close the dialog as expected. However, on one occasion received following error (with 8u60): 2015-09-02 06:03:29.089 java[72236:707] Error in CoreDragGetMouseLocation: -1850 Note: Above is likely a MAC specific error. The issue is partially observed, so moving this up for the dev. team review.
02-09-2015