Removing "click to activate applet" , here is a workaround

this is a simple workaround to avoid “click to activate control”, working on IE7
juste create the 3 following files with th right name, compile it & try it!

SimpleApplet.htm


<HTML>
<HEAD>
<SCRIPT language=JavaScript src=SimpleApplet.js></SCRIPT>
</HEAD>
<BODY BGCOLOR="000000" onload="createApplet()">
<CENTER>
<DIV ID=target></DIV>
</CENTER>
</BODY>
</HTML>

SimpleApplet.js


/**
 * SimpleApplet.js
 *
 * @author bruno augier
 * @email bruno.augier@dzzd.net
 * @website http://dzzd.net/
 * @version 1.00 2007/07/18
 */

function createApplet()
{
 var elem=document.getElementById("target");
 html="<APPLET\n";
 html+="code	= 'SimpleApplet.class'\n" ;
 html+="width	= '600'\n";
 html+="height	= '360'\n";
 html+="></APPLET>\n" ;
 elem.innerHTML=html;
 setTimeout("focusApplet()",1000);
}


function focusApplet()
{
	if(document.applets[0]!=null)
	{
		document.applets[0].focus();
		document.applets[0].click();
		
	}
	else
		setTimeout("focusApplet()",1000);
}

SimpleApplet.java


/**
 * SimpleApplet.java
 *
 * @author bruno augier
 * @email bruno.augier@dzzd.net
 * @website http://dzzd.net/
 * @version 1.00 2007/07/18
 */
 
import java.awt.*;
import java.applet.*;
import java.awt.event.*;


public class SimpleApplet extends Applet implements MouseMotionListener,Runnable
{
	private int mousePosX;		//Last know mouse pos x (relative to upper corner)
	private int mousePosY;		//Last know mouse pos y (relative to upper corner)
	private boolean run;
	
	public void init()
	{
		this.run=true;
		this.addMouseMotionListener(this);
		Thread t=new Thread(this);
		t.start();
	}
	
	public void run()
	{
		try
		{
			while(this.run)
			{
				this.update(this.getGraphics());
				Thread.sleep(10);
			}
		}
		catch(InterruptedException ie)
		{
		}
	}
	
	public void destroy()
	{
		this.run=false;
		try
		{
			Thread.sleep(100);
		}
		catch(InterruptedException ie)
		{
		}		
	}
	
	public void update(Graphics g) 
	{
		g.setColor(new Color(0x000000));
		g.fillRect(this.mousePosX, this.mousePosY,2,2);
	}
	
	public void paint(Graphics g)
	{
	}
	
	
	public void mouseDragged(MouseEvent e)
	{
	}
	
	public void mouseMoved(MouseEvent e)
	{
		this.mousePosX=e.getX();	
		this.mousePosY=e.getY();
	} 

}

I just put this demo online:

http://dzzd.net/SimpleApplet/

no need to click on the applet to activate it

Hi DzzD,

Confirmed:

JDK 1.5.0_b10
on Windows XP

Running IE 6.0.2900.2180.xpsp_sp2
and
Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5

Nice job!

Best regards from

M.E.

Firefox 2.0.0.5, WinXP, Java 5; works!