JDK-6888200 : Owner frame should be activated on closing a modal dialog.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u20-rev,7
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: solaris_10,windows
  • CPU: x86,sparc
  • Submitted: 2009-10-05
  • Updated: 2011-01-19
  • Resolved: 2010-08-09
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 6 JDK 7
6-poolResolved 7Resolved
Related Reports
Relates :  
Description
The problem was originally reported here:

http://forums.java.net/jive/thread.jspa?messageID=366737

THE PROBLEM:

Closing modal dialog doesn't activate its owner.

HOW TO REPRODUCE:

Compile and run the testcase below.

1. Two frames and one dialog will appear. Make sure the dialog is focused.
2. Alt-tab to the frame "f0".
3. Alt-Tab to the dialog again.
4. Close the dialog.

EXPECTED BEHAVIOR:

The frame "f1" (the owner of the dialog) gets activated.

ACTUAL BEHAVIOR:

The previously active frame "f0" gets activated.


Note that this works fine on Linux.

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

public class Test {

	public static void main(String[] args) {
		JFrame f0 = new JFrame("f0");
		JFrame f1 = new JFrame("f1");
		JDialog d = new JDialog(f1);

		d.setModalityType(JDialog.ModalityType.DOCUMENT_MODAL);

		f0.add(new JButton("frame0"));
		f1.add(new JButton("frame1"));
		d.add(new JButton("dialog"));

		f1.setLocation(200, 0);
		d.setLocation(0, 200);

		f0.pack();
		f1.pack();
		d.pack();

		f0.setVisible(true);
		f1.setVisible(true);
		d.setVisible(true);
	}
}
=======================================================================

Comments
EVALUATION This is not a defect, but implemented this way by design. On Windows, we store a list of ever activated windows and activate the last active window when the dialog gets hidden.
09-08-2010

EVALUATION The symptom looks similar to 6262392, though the latter is about X11. Perhaps it's worth fixing the issue in the shared code to address both at once.
06-10-2009