JDK-6741987 : asynchronous activation by syntheric messages causes to focus problem
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: x86
  • Submitted: 2008-08-27
  • Updated: 2011-01-19
  • Resolved: 2009-03-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Relates :  
Description
the testcase to reproduce the focus problem:

============== App.html ======================
<HTML>
<HEAD>
<APPLET CODE="App1.class" WIDTH=100 HEIGHT=100></APPLET>
</HTML>
==============================================

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

public class App1 extends JApplet {

    public void start() {
        Container c = getParent();
        while (!(c instanceof Window)) {
            c = c.getParent();
        }
        Frame eframe = (Frame)c;

        JWindow window = new JWindow(eframe);
	window.setLayout(new FlowLayout());
        window.setBounds(300, 0, 100, 100);
        window.add(new JCheckBox("check"));
        window.setVisible(true);
    }
}
================================================

Just run the testcase and try to click on the checkbox,
sometimes the checkbox will not change its state.

platforms:
Windows Vista|XP, reproducible using jdk5 u14, latest jdk7

the same problem described in http://monaco.sfbay/detail.jsf?cr=6638103
the 6638103 bug includes the Starwood's testcase

Comments
EVALUATION The fix for 6806217 introduced new focus mechanism for MS Windows AWT. Clicking a component in a Window (not Frame/Dialog) doesn't steal activation (as it did before) from the owner. So the owner remains active and the "bounce-activation" logic is no longer used. This resolves the problem of this CR.
11-03-2009

EVALUATION There are some place in the AWT code we call ::SetActiveWindow to activate the browser's top level. These calls initiate the synthetic activation of the embedded frame and the activation transfers the focus to the embedded frame, please refer to 4922092 for more information. The activation occurs on the plugin thread and it may steal the focus from the proxy window. To fix the problem we should guarantee that AWT transfers the focus to the proxy window after the synthetic activation completes.
27-08-2008

SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/7/6741987
27-08-2008