JDK-6465439 : applet doesn't recieve focus on TAB traversing
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: generic
  • Submitted: 2006-08-30
  • Updated: 2011-01-19
  • Resolved: 2006-09-07
Related Reports
Duplicate :  
Relates :  
Description
I'm using  IE 6.0 with installed JRE6.0b97.
When HTML page contains an applet and some HTML controls applet doesn't recieve focus when I pressing TAB repeatedly.

Steps to reproduce the problem:
1) load TestApplet from the description
2) click mouse in the first text field ("Mickey")
3) press TAB several times
4) if applet's textfield ("Type me") don't obtain focus the bug reproduced.
5) I noticed that after the last component in the page the focus goes to address line and stays there if even I press TAB.

Now how to avoid this issue.
1) load TestApplet from the description
2) click mouse in the first text("Type me")  or on button("Push me") in applet.
3) press TAB several times
4) now applet can obtains focus.
5) I noticed that after the last component in the page the focus goes to address line and returns to the first component if I press TAB.


<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=windows-1252">
<TITLE>
Test Focus Applet
</TITLE>
</HEAD>
<BODY>
<form>
First name:
<input type="text" name="fname" value="Mickey" />
<br />
Last name:
<input type="text" name="lname" value="Mouse" />
<br />
<input type="submit" value="Submit" />
</form>
Applet
<comment> <applet code="TestApplet.class" codebase="." width="850"
height="500"></applet> </comment>
<form>
Address:
<input type="text" name="address" value="San Jose" />
<br />
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="50%" height="50%" tabindex="1" name="cmpm-1"

codebase="http://java.sun.com/products/plugin/1.4/jinstall-14-win32.cab#Version=1,4,0,0">
  <param name=CODE            value="TestApplet.class" >
  <param name=NAME            value="TestApplet" >
  <param name=CODEBASE        value="./">
  <param name="type"          value="application/x-java-applet;version=1.4">
  <param name="scriptable"    value="false">
  <param name="IMG"           value="img01.gif">
  <comment> <embed  type="application/x-java-applet;version=1.4"
                            code="TestApplet.class"
                            name="TestApplet"
                            codebase="./"
                            width="100%" height="100%"
                            img="img01.gif"
                            scriptable=false
                                                                        
pluginspage="http://java.sun.com/products/plugin/1.4/plugin-install.html">

<noembed> </noembed>
</embed> </comment>
</object>
Country:
<input type="text" name="country" value="USA" />
<br />
<input type="submit" value="California?" />
</form>
</BODY>
</HTML>

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
                                                                        
                                                                        
public class TestApplet extends JApplet
{
 JButton button;
 JTextField field;

 public void init()
 {
      
     // Set the focus traversal policy
     	setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
	Container parent = this.getParent ();
	while (!(parent instanceof Window) && parent != null)
   	{
		parent= parent.getParent ();
	}
	if (parent != null)
	{
		parent.setFocusTraversalPolicy (new javax.swing.LayoutFocusTraversalPolicy ());
  	}
      
	button = new JButton("Push Me");
	field = new JTextField("Type Me");
	getContentPane().setLayout(new GridLayout(1,2));
	getContentPane().add(button);
	getContentPane().add(field);
 }
}

Comments
EVALUATION Duplicate of 6463913. Cannot tab into, or out of applet. The focus does not go into applet. If I manually click on any component inside the applet, the focus traversal will now be within applet, and I cannot tab out of the applet.
07-09-2006