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

Modal dialog does not freeze parent window on X11 as much as it does on Windows.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description



      Name: gm110360 Date: 01/27/2004


      FULL PRODUCT VERSION :
      1.3.1_09, 1.4.1, 1.4.2, 1.4.2_03

      ADDITIONAL OS VERSION INFORMATION :
      Debian Linux, RedHat Linux, Sparc Solaris.

      A DESCRIPTION OF THE PROBLEM :
      When a modal dialog freezes its parent window, it is still possible to close the frozen window using the close button of the window manager. Note that on Microsoft Windows, the close button is as frozen as the rest of the window.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached code, and follow the given directions.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Mouse click on the close button of the parent window of the modal dialog, should be ignored, as the modal dialog is there. On Microsoft Windows, the mouse click event is filtered.
      ACTUAL -
      But on X11, the mouse click event is passed to the application, violating the whole principle of modal windows.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.*;
      import java.awt.*;

      public class ModalTest {
          public static void main(String[] args) {
              final Frame frame = new Frame();
              Button button1 = new Button("Click me to start");
              frame.setLayout(new BorderLayout());
              frame.add(new Label("This is the main app frame"));
              frame.add(button1);
              frame.pack();
              frame.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) { System.exit(0); }
              });

              final Dialog dialog = new Dialog(frame);
              Button button2 = new Button("Open the modal dialog");
              dialog.setLayout(new BorderLayout());
              dialog.add(new Label("This is the parent dialog. When a modal dialog freezes it,"), BorderLayout.NORTH);
              dialog.add(new Label("it is still be possible to close it."), BorderLayout.CENTER);
              dialog.add(button2, BorderLayout.SOUTH);
              dialog.pack();
              dialog.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) { dialog.setVisible(false); }
              });

              final Dialog dialog2 = new Dialog(dialog);
              dialog2.setLayout(new BorderLayout());
              dialog2.add(new Label("This is a modal dialog, child of the previous one,"), BorderLayout.CENTER);
              dialog2.add(new Label("but you can still close its 'frozen' parent"), BorderLayout.SOUTH);
              dialog2.pack();
              dialog2.setModal(true);
              dialog2.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) { dialog2.setVisible(false); }
              });

              button1.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      dialog.setVisible(true);
                  }
              });

              button2.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      dialog2.setVisible(true);
                  }
              });

              frame.setVisible(true);
          }
      }

      ---------- END SOURCE ----------
      (Incident Review ID: 235773)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              son Oleg Sukhodolsky (Inactive)
              Reporter:
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: