Holomatix

Log In / Register


Purchase
When I turn the applet visible using javascript, the display does not refresh under the Sun JVM.

If you hide and show the applet by setting its visibility property through javascript, then the java applet does not refresh its whole window when played under the Sun JVM.

To fix this, you need to cause the applet to update yourself by calling its repaint() method after a time delay. To do this, your applet needs two things. It should have a 'MAYSCRIPT' attribute to allow javascript to communicate with it, and you should name the applet by giving it an 'id' attribute:

<applet archive=holomatix.jar width=600 height=400 code=blaze3d.class MAYSCRIPT id="myBlaze">
...
</applet>

Then, when you reveal the applet, you can call its repaint() method:

document.myBlaze.style.visibility = "visible";
setTimeout('document.myBlaze.repaint()',10);

This must be called after a short delay, as it must execute after the applet has been made visible.

As an example, you might have two buttons, one to turn the applet invisible, and one to make it visible again:

<SCRIPT language=JavaScript>
function makeVisible()
{
 document.myBlaze.style.visibility = 'visible';
}
function makeInvisible()
{
 document.myBlaze.style.visibility = 'hidden';
}
</SCRIPT>
<A href="javascript:makeInvisible();">Make invisible</A>
<A href="javascript:makeVisible();" onClick="setTimeout('document.myBlaze.repaint()',10);">Make visible</A>
 
< Prev   Next >


© Copyright 2000-2011 Holomatix Ltd. All rights reserved.