JDK-6890545 : Modal Dialog block input to all frame windows not just its parent.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u16
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2009-10-12
  • Updated: 2011-02-16
  • Resolved: 2009-10-12
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
1.6.0_16

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2

A DESCRIPTION OF THE PROBLEM :
Create two or more frame windows.  Display a modal dialog using
one of the frame windows as a parent.

All frame windows will be blocked.


This problem appeared when I upgraded from 1.5 to 1.6.  A previous bug was reported for this same issue (4080029) but was fixed in a previous release (mustang b38)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a Frame with a button inside that will make a Dialog visible when clicked	
2)  Create a second frame with a button inside that will display a msg to standard out
3) Now run test program and you will see two frames
4) Click on frame 2 to verify the standard out is displayed
5) Click on frame 1 to display the dialog
6) Now goto frame 2 and click button.  Note that the messages wont display until dialog is closed.


ACTUAL -
  From frame 1 click button to display modal dialog
A dialog is created and is visible
Set focus to other frame window and click button inside
No output displayed from clicking button

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class FrameTest {

	Frame f1, f2;
	Dialog d1;
	Button b1, b2;

	WebBrowser webBrowser;

	public FrameTest() {
		f1 = new Frame("Test Frame1");

		d1 = new Dialog(f1, "Modal Dialog", true);
		d1.setSize(150, 100);
		d1.setLocation(225, 400);
		d1.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent we) {
				d1.setVisible(false);
			}
		});
		
		b1 = new Button("Show Modal Dialog");
		b1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				d1.setVisible(true);
			}
		});
		f1.add(b1);
		f1.setSize(175, 100);
		f1.setLocation(0, 400);
		
		f2 = new Frame("Test Frame2");
		b2 = new Button("Click Me!");
		b2.addMouseListener(new MouseAdapter() {
			public void mouseClicked(MouseEvent e) {
				System.out.println("Test Frame2 Button Clicked");
			}
		});
		f2.add(b2);
		f2.setSize(175, 100);
		f2.setLocation(400, 400);

		f2.setVisible(true);
		f1.setVisible(true);
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.print("Test Frame");
		new FrameTest();
	}

}

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

CUSTOMER SUBMITTED WORKAROUND :
No workaround discovered

Release Regression From : 5.0
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION With the fix for 4080029 2 more modality types were introduced for modal dialogs: DOCUMENT_MODAL and TOOLKIT_MODAL - but the default type is left the same, and therefore the modal dialog still blocks all the frames by default. To block only its parent, the dialog should be created with DOCUMENT_MODAL modality type.
12-10-2009