JDK-6482294 : Empty applet doesn't initially get focus
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2006-10-16
  • Updated: 2011-04-29
Related Reports
Relates :  
Description
Run the provided test case in a browser or appletViewer 
and notice that the applet doesn't get initially focus

Expected:
Applet should get focus after it was loaded

Current:
Applet doesn't get focus
see 6471783 (item 1 & 2 from description)
for related problems

import java.applet.Applet;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

public class AwtApplet extends Applet {

    public void init() {
        super.init();
        addFocusListener(new FocusListener() {
            public void focusGained(FocusEvent e) {
                System.out.println("AwtApplet.focusGained");
            }
            public void focusLost(FocusEvent e) {
            }
        });
    }
}

Comments
EVALUATION Needs to discuss the issue with deploy team.
17-10-2006

WORK AROUND Request
17-10-2006

SUGGESTED FIX Request focus on the applet explicitly from init() or start().
17-10-2006

EVALUATION This behavior has been changed exactly in 1.4. An applet no longer gets focus if it doesn't contain focusable components.
17-10-2006

EVALUATION See also 6471783 (item 1 & 2 from description) I tested the test case with 1.4 it works the same way so it doesn't seem to be a regression
16-10-2006