JDK-6322803 : Dialog TOOLKIT_MODAL does not block null-parent FileDialog
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-09-12
  • Updated: 2011-01-19
  • Resolved: 2005-09-13
Related Reports
Duplicate :  
Description
The following bug was found when fixing 6302514 after assigning a null parent to print/pag dialogs, the null-parent dialogs are found to be unblocked.  FileDialog and Print/Page Dialogs both uses Window peers and share modality-related code.

import java.awt.*;
import java.awt.event.*;

public class FileDialogTest {

    public static void main(String[] args) {
        final Dialog td = new Dialog((Frame) null, "Toolkit modal dialog",
                               Dialog.ModalityType.TOOLKIT_MODAL);
        td.setLayout(new FlowLayout());^M
    ^M
    Button printbtn2 = new Button("File Dialog");^M
        ^M
    printbtn2.addActionListener(new ActionListener() {^M
    public void actionPerformed(ActionEvent event) {^M
        //FileDialog jd = new FileDialog(td, "FileDialog Test");        ^M
        FileDialog jd = new FileDialog((Dialog)null, "FileDialog Test");        ^M
        jd.show();^M
            }^M
    });^M
    td.add(printbtn2);^M

        td.setSize(250, 150);
        td.setVisible(true);
    }
}

Comments
EVALUATION This happens only on Windows platform for native dialogs. That is exactly the same as 6278099.
13-09-2005