JDK-4984135 : Modal dialog does not freeze parent window on X11 as much as it does on Windows.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-01-27
  • Updated: 2004-01-28
  • Resolved: 2004-01-28
Related Reports
Duplicate :  
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) 
======================================================================

Comments
EVALUATION Name: osR10079 Date: 01/28/2004 The problem with closing of modal dialog's parent is duplicate of 4336913 (On Win32, disable parent window controls while modal dialog is being created.) (although its synopsis says about Win32 the problem described in that bug occurs on all platforms). 4336913 was fixed in tiger. So, I close this bug as duplicate of 4336913. ###@###.### Jan 28, 2004 ======================================================================
24-08-2004