JDK-6332100 : Focus lost in Textfield after doing a back/forward from Internet Explorer using
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 1.4.2_10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2005-10-04
  • Updated: 2011-02-16
  • Resolved: 2006-04-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.
Other
1.4.2_12 b02Fixed
Related Reports
Relates :  
Description
Using the following file(s):

   appletTextFieldCursor.html (note: 'legacy_lifecycle=true')
   TextFieldCursor.java

On Windows 2000, run the testcase with the jre 1.4.2_07 plugin via IE.          1)Launch IE where a webpage (www.javasoft.com) is displayed.
2)Then open the appletTextFieldCursor.html by using File->Open.
3)When the testcase appears you'll see a Form with a single non-navigable JButton() and a JTextField() with "555" highlighted.  4)Now, use the IE browsers back button and forward button until you see the JTextField() looses focus. We have found that this testcase does not reproduce on Windows XP.

JDK/JRE tested with:
   1.4.2_07/08/09
   1.5.2_04


<html>
<head>
  <title>TextFieldCursor (Oracle)</title>
</head>
<body>
<object classid="clsid:CAFEEFAC-0014-0002-0008-ABCDEFFEDCBA"
        WIDTH="400" HEIGHT="300">
<param name="TYPE"     value="application/x-java-applet;jpi-version=1.4.2_08">
<param name="IE"       value="native" >
<param name="legacy_lifecycle" value="true" >
<param name="CODE"     value="TextFieldCursor" >
</object>
</body>
</html>



import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class TextFieldCursor extends JApplet
                             implements ComponentListener,
                                        ActionListener
{

    JTextField textField;
    JTextArea textArea;
    JButton jButton;

    private boolean          mFocusRequestedForApplet = false;

    public void init()
    {
        textField = new JTextField();
        textField.addActionListener(this);
        jButton = new JButton();

        getContentPane().setLayout(null);
        textField.setText("555");
        textField.setBounds(new Rectangle(100, 40, 150, 30));
        textField.setFont(new Font("Arial", 0, 16));

        jButton.setText("Button");
        jButton.setRequestFocusEnabled(false);
        jButton.setBounds(new Rectangle(130, 75, 90, 30));
        jButton.setToolTipText("");
        getContentPane().add(jButton, null);
        getContentPane().add(textField, null);

        getContentPane().setVisible(true);
        setVisible(true);

        textField.requestFocus();
        textField.selectAll();
    }


    public void actionPerformed(ActionEvent evt)
    {

    }


    public void start()
    {
        addComponentListener(this);
    }


    /**
    ** Stops the Applet.
    **
    ** @see java.applet.Applet
    */
    public void stop()
    {
        removeComponentListener(this);
        mFocusRequestedForApplet = false;
    }


    //------------------------------------------------------------------------
    // ComponentListener Interface
    //------------------------------------------------------------------------
    public void componentResized(ComponentEvent e)
    {

    }


    public void componentMoved(ComponentEvent e)
    {

    }


    public void componentShown(ComponentEvent e)
    {
        textField.requestFocus();
        textField.selectAll();
        mFocusRequestedForApplet = true;
    }


    public void componentHidden(ComponentEvent e)
    {

    }


    public void requestFocus()
    {
        if ( !mFocusRequestedForApplet )
        {
            super.requestFocus();
        }
    }

}

Comments
SUGGESTED FIX Adding the InPlaceActivate function call to the CAxControl of the java plugin seems to resolve this matter. A relief binary has been sent to the customer for verification.
08-02-2006

EVALUATION I tried the latest testcase and still cannot reproduce. As customer also cannot reproduce with window xp, I guess it may be an issue of Windows OS. I used windows 2000 prefessional , SP4 with JRE 1.5.0_05 to do testing.
01-11-2005

EVALUATION I tried 1.4.2_08 on windows 2000 server and cannot reproduce this bug. I press "back" and "forward" button 10 times. BTW there is no 1.5.2_04, so I just tried 1.5.0_05 from java.sun.com and also cannot reproduce it. please provide more info , such as how many times to press "back" and "forward", what's version of windows 2000 ( prefession or server, service pack , etc) Steps to reproduce this bug: @ Testcase: @ 1) Launch IE (javasoft.com) and wait for the website to fully load, @ 2) Run the testcase, @ 3) Use the back/forward button - this may take 10- 30 iterations (at most) @ but usually occurs around 5-15 iterations. Durring my testing, after @ executing the back button I sometimes waited for all the images to @ repaint until the forward button was executed. @ . @ Also, this testcase demonstrates a loss of focus when you navigate to a @ window that overlays the testcase. For example, when running the testcase @ the java console is launched in the upper left hand corner. The testcase is @ then displayed over the java console. If you navigate to the java console and @ it overlays the textfield then navigate back to the testcase you will notice @ that the textfield has lost focus. @ . @ The 1.5 release(s) that were tested (1.5.2 was a typo): @ jre-1_5_0_04-windows-i586-p.exe @ jre-1_5_0_05-windows-i586-p.exe
18-10-2005