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

Dialog TOOLKIT_MODAL does not block null-parent FileDialog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • client-libs
    • x86
    • windows_xp

      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);
          }
      }

            art Artem Ananiev (Inactive)
            jgodinez Jennifer Godinez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: