Java TextField Focus Not Set in Some Environments

(Sun bug #6646582)

Summary:  Focus was not set for TextFields in Java applets in some environments. However, in recent Java versions focus is set once the user clicks on the applet.

Steps to Reproduce:
1.
Make sure the browser has Java installed. 
2. In the applet displayed on this page, click the purple area to make the applet active.
3. Look for a cursor in the TextField and type some text.

Actual Results: Using Sun Java 7 build 76 or Sun Java 6 update 17, focus is set once the user clicks anywhere on the applet, using either Firefox 3.55 or Internet Explorer 7 on Vista. 

Expected Results:  Now same as actual.


Notes:
In all environments the applet does not have focus until it is clicked on.  If you have any insights, workarounds or comments about this test page please contact Mickey Segal.  A listing of  many Java resources is at this link.

Source code:

import java.awt.*;
import java.applet.*;

public class TextFieldFocus extends Applet {

public void init()
{
    setBackground(new Color(240, 220, 255));
    TextField tf = new TextField(15);
    add (tf);
    tf.requestFocus();
}
} // END OF Class TextFieldFocus