Reputation: 463
I have a Jar File which run the applet. This Jar File is called by Call_Applet_Jar.html file which is in www directory. The Call_Applet_Jar.html file has a javascript and html codes. The Jar File is called by html codes which are in Call_Applet_Jar.html. The applet opens too late on browsers. For example applet opens in five seconds with unix o.s's browsers despite this the applet opens in 15 seconds with windows o.s's browsers. Namely applet run quick on unix's browsers but it can not run quick on windows's browsers. So that I want to show progress bar while the applet is loading. But I can't understand when the applet becomes fully operational on browser. Namely I must know loading time's start and finish point to add progress bar. How to understand time when the applet becomes fully operational on browser with Javascript or HTML. The progress bar must disappear when the applet becomes full operational on web browsers. How can i know this time with javascript or html?Any idea? Thanks in advance ..
Upvotes: 0
Views: 1173
Reputation: 320
You can't know with javascript or html when java applet loaded completely on browsers. To load applet on browsers.
1--> JVM should runned.
2-->The jar should downloaded and ran.
3-->The ready() method should access to page
All of them are not understood by javascript or html. You must call javascript function from java applet when applet is loaded completely on browser. Namely java applet should give notice to javascript side. In this way you can understand the applet is loaded completely on browser. The example code is below.
package example_package;
import netscape.javascript.*;
public class Example_Applet_Class extends Applet {
public void start() {
try {
JSObject calling_object = JSObject.getWindow(this);
//to call javascript method when the applet is loaded on browser completely..
String passing_argument = "applet jar is downloaded";
calling_object.call("javascript_function" , new Object[] {passing_argument});
//or you can set the javascript object when applet is loaded on browser completely..
String assign_value_js_object = "loaded";
calling_object.setMember("js_object",assign_value_js_object);
} catch (JSException jse) {
jse.printStackTrace();
}
///**//Javascript Side//**///
<head>
<title>JavaScript Side</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
<script language="javascript">
var js_object= "";
if(js_object == "loaded")
{
//The code which should ran when the applet is loaded completely on browsers.
}
//Called from java Applet
function javascript_function(argument_came_from_java_applet)
{
//The code which should ran when the applet is loaded completely on browsers.
}
</script>
</head>
<body>
...
</body>
Upvotes: 0
Reputation: 7921
Please see Displaying a Customized Loading Progress Indicator:
A Java applet can display a customized loading progress indicator that shows the progress of download of the applet's resources as well as other applet specific data.
Upvotes: 1