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

Dismiss modal dialog, focus erroneously goes to Internet Explorer 7 window

XMLWordPrintable

    • b04
    • x86
    • windows_xp, windows_vista
    • Verified

        FULL PRODUCT VERSION :
        java version "1.5.0_14"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
        Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]

        A DESCRIPTION OF THE PROBLEM :
        After dismissing a modal dialog with a JFrame parent, focus is erroneously returned to the applet host browser. This is only a problem when using Internet Explorer 7. Works correctly with IE6, and Firefox.
        This is only a problem with Java 1.5.0_14 and up.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
          To Reproduce Bug:
        Run an applet in Internet Explorer 7 that opens a JFrame window.
          From window, open a modal dialog.
        Dismiss modal dialog.


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Expected Result:
        Focus returns to the dialog's parent, the JFrame window.
        ACTUAL -
        Actual Result:
        Focus returns to Internet Explorer 7.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        ------------------- javaBug.html -------------------------
        <HTML>
        <HEAD>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
        <TITLE>
        Demo JRE 1.5_0.14 Plugin bug for IE7.
        </TITLE>
        </HEAD>
        <BODY BGCOLOR="#FFFFFF">

        <CENTER>
        <OBJECT classid="clsid:CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA"
        WIDTH = "300"
        HEIGHT = "100"
        codebase="http://localhost/jre-1_5_0_14-windows-i586-p.exe#Version=1,5,0,14"
        STANDBY="Please wait, while your browser downloads the required files.">

        <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.5.0_14">
        <PARAM NAME = CODE VALUE = "com.javasoft.JavaBug.class">
        <PARAM NAME = CODEBASE VALUE = "http://localhost/javabug/">
        <PARAM NAME = NAME VALUE = "JavaBug">
        <PARAM NAME = HSPACE VALUE = "0">
        <PARAM NAME = VSPACE VALUE = "0">
        <PARAM NAME = ALIGN VALUE = "top">
        <PARAM name = progressbar value = "true">

        <COMMENT>
        <EMBED type="application/x-java-applet;jpi-version=1.5.0_14"
        java_CODE = "com.javasoft.JavaBug.class"
        java_CODEBASE = "http://localhost/javabug/"
        NAME = "JavaBug"
        HSPACE = "0"
        VSPACE = "0"
        HEIGHT = "500"
        ALIGN = "top">
        </COMMENT>

        <NOEMBED>
        Error loading Applet, please ensure your web browser <BR>
        1. &nbsp Supports HTML version 4.0 <BR>
        2. &nbsp You have the Java Plugin version 1.5.0_14 installed<BR>
        </NOEMBED>
        </EMBED>
        </OBJECT>
        </CENTER>
        </BODY>
        </HTML>



        ------------------------ JavaBug.java -------------------------

        package com.javasoft;

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

        public class JavaBug extends Applet
        {
        JButton button;
        MyFrame frame;
        public void init()
        {
        button = new JButton("Open Window");
        button.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent ae){
        button.setEnabled(false);

        frame = new MyFrame("Demo Modal Dialog/IE7 Bug");
        frame.setVisible(true);
        }
        });
        add(button, null);
        }


        class MyFrame extends JFrame
        {
        JButton frameButton;
        JDialog frameDialog;
        public MyFrame(String title)
        {
        setTitle(title);
        setLayout(new BorderLayout());

        frameButton = new JButton("Display Modal Dialog");
        frameButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent ae){
        frameButton.setEnabled(false);

        frameDialog = new JDialog(MyFrame.this, "Modal Dialog", true);
        frameDialog.setLayout(new BorderLayout());
        frameDialog.add(new JLabel("This is a modal dialog"), BorderLayout.NORTH);


        JButton closeButton = new JButton("Close");
        closeButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent ae){
        frameDialog.setVisible(false);
        }
        });
        frameDialog.add(closeButton, BorderLayout.SOUTH);
        frameDialog.pack();

        frameDialog.setVisible(true);
        }
        });
        add(frameButton, BorderLayout.SOUTH);


        JTextArea text = new JTextArea();
        text.setColumns(30);
        text.setRows(10);
        text.setText("This window should regain focus\nafter dismissing modal dialog");
        JScrollPane scroll = new JScrollPane(text);
        add(scroll, BorderLayout.CENTER);

        pack();
        }
        }
        }

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

        CUSTOMER SUBMITTED WORKAROUND :
        Back down to Java 1.5.0_13, as our clients are using Internet Explorer 7.

        Release Regression From : 5.0u13
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.

              robm Robert Mckenna
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: