| 
 Duplicate :   
 | 
|
| 
 Duplicate :   
 | 
|
| 
 Relates :   
 | 
Name: jk109818			Date: 12/12/2002
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When non-modal dialog is launched from modal dialog it
receives keyboard events but not mouse events. It should
not receive any events.
REGRESSION.  Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile code provided, and start program.
2. In the frame click "Open modal dialog" button. The modal
dialog will popup.
3. Press "Open non-modal dialog" button. Another dialog will
popup.
4. Use "Tab" key to switch between controls of type in the
text field - key events happen.
5. Now try mouse clicks on any of the controls - nothing
happens.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Key events should not go through (as in version 1.3.1)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class SwingBug {
    public static void main(String[] args) throws Exception {
        final JFrame f = new JFrame("Frame");
        final JDialog d1 = new JDialog(f, "Modal Dialog", true);
        final JButton b2 = new JButton("Open non-modal dialog");
        b2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JDialog d2 = new JDialog(f, "Non-Modal Dialog", false);
                d1.setEnabled(false);
                d2.addWindowListener(new WindowAdapter() {
                    public void windowClosing(WindowEvent e2) {
                        d1.setEnabled(true);
                    }
                });
                JPanel p = new JPanel();
                p.add(new JTextField(10));
                p.add(new JCheckBox("checkbox 1"));
                p.add(new JCheckBox("checkbox 2"));
                d2.getContentPane().add(p);
                d2.pack();
                d2.setVisible(true);
            }
        });
        JButton b1 = new JButton("Open modal dialog");
        b1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                d1.getContentPane().add(b2);
                d1.pack();
                d1.setVisible(true);
            }
        });
        f.getContentPane().add(b1);
        f.pack();
        f.show();
    }
}
---------- END SOURCE ----------
Release Regression From : 1.3.1_06
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.
(Review ID: 165912) 
======================================================================
  |