JDK-6432035 : Unable to edit content of JTextField intermittently following modal dialog
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0,5.0u11
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux
  • CPU: x86
  • Submitted: 2006-05-31
  • Updated: 2011-02-16
  • Resolved: 2007-08-16
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
SUSE Linux 10 ("2.6.3-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 i686 i386 GNU/Linux")

bug also reproduced on RedHat Linux Fedora Core 5 ("2.6.15-1.2054_FC5 #1 Tue Mar 14 15:48:33 EST 2006 i686 i686 i386 GNU/Linux")

EXTRA RELEVANT SYSTEM CONFIGURATION :
This problem has been observed using Mozilla Firefox 1.0.6, 1.5.0.1 and 1.5.0.3.
SUSE Linux is using KDE3.4
RedHat Linux is using TWM.

A DESCRIPTION OF THE PROBLEM :
There is an intermittent problem after an applet has displayed a modal dialog window. The user can click in a JTextField and select text with the mouse, but the JTextField no longer responds to keyboard input. Sometimes getting the applet to display a modal dialog again restores the ability to type in the field.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the attached source code and deploy it as an applet.
2. Create an HTML page in which to embed the applet.
3. Open the browser and navigate to the page containing the applet.
4. Click in the JTextField and type some text.
5. Click the JButton.
6. Dismiss the dialog.
7. Select some text in the JTextField and type over it.
8. Repeat steps 5 - 7 continuously.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After dismissing the dialog, it should always be possible to select text and type in the JTextField.
ACTUAL -
After a few attempts on SUSE Linux it is not possible to type in the field in step 7, although the field responds to the mouse highlighting text.

This problem occurs readily on SUSE/KDE, much less so on RedHat/TWM, but it has been seen on both platforms.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No stack trace appears in the Java console.

REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
package test;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class TestApplet
        extends JApplet
        implements ActionListener {
    
    public void init() {
        Container c = getContentPane();
        JTextField txt = new JTextField("Hello");
        JButton cmd = new JButton("click me");
        cmd.addActionListener(this);
        c.add(txt, BorderLayout.CENTER);
        c.add(cmd, BorderLayout.EAST);
    }
    
    public void actionPerformed(ActionEvent e) {
        JOptionPane.showMessageDialog(this, "I told you so");
    }
}

---------- END SOURCE ----------

Comments
EVALUATION According to customer the bug is not reproducible any more.
16-08-2007

EVALUATION It seems that this problem is not caused by dispatching events in wrong AppContexts, but rather some focus and XEmbed implementation. According to XEmbed log, after the modal dialog is hidden, applet receives XEMBED_FOCUS_IN/XEMBED_FOCUS_FIRST message, but fails to request focus for the last focused component. This looks very close to 6527109.
01-03-2007

EVALUATION Reproducible also with 6.0-beta2 on linux/GNOME/Mozilla.
02-06-2006

EVALUATION The source of this bug may be the same as for 6430995: sometimes events are handled in different appcontexts. Needs further investigation.
02-06-2006