PhilAllen
asked on
Applet loading progress meter for java1.1
I have a largish applet with images that at present is stored in a signed cab file.
I wish to have a progress indicator so that the users
can see something happening.
This is similar to another question posed a few months back which objects answered
However I am using java1.1 and objects answer would not work as it uses URLClassLoader (not available on 1.1 I reckon)
ANother proposed answer (from matt c) was :
- get a certificate and overrride the ClassLoader to load all your classes. On each download of a class,
you will update your progress bar.
Could anyone enlighten me please
Ideally I would want to get the progress indicator up asap
then pull in a jar file with say 50K of classes or images
and update the progress indicator
repeat the above 9 more times and it's done..
And the browser would need to cache the pulled in Jar files ...
I wish to have a progress indicator so that the users
can see something happening.
This is similar to another question posed a few months back which objects answered
However I am using java1.1 and objects answer would not work as it uses URLClassLoader (not available on 1.1 I reckon)
ANother proposed answer (from matt c) was :
- get a certificate and overrride the ClassLoader to load all your classes. On each download of a class,
you will update your progress bar.
Could anyone enlighten me please
Ideally I would want to get the progress indicator up asap
then pull in a jar file with say 50K of classes or images
and update the progress indicator
repeat the above 9 more times and it's done..
And the browser would need to cache the pulled in Jar files ...
Something like this. The important thing is that the loader applet has no references to any classes in your main jar.
public class AppletLoader extends Applet
implements Runnable
{
private String mainClass;
private void loadApplet(String cn)
{
// Start up a thread to load main applet
mainClass = cn;
new Thread(this).start();
}
public void run()
{
try
{
// Instantiate the main class
// This will cause the browser to download
// required classes.
Class c = Class.forName(mainClass);
Component comp =(Component)c.newInstance( );
add(comp);
}
catch (Exception e)
{
e.printStackTrace();
}
invalidate();
validate();
}
public void init()
{
// start up your progress bar
loadApplet("MyApplet");
}
}
public class AppletLoader extends Applet
implements Runnable
{
private String mainClass;
private void loadApplet(String cn)
{
// Start up a thread to load main applet
mainClass = cn;
new Thread(this).start();
}
public void run()
{
try
{
// Instantiate the main class
// This will cause the browser to download
// required classes.
Class c = Class.forName(mainClass);
Component comp =(Component)c.newInstance(
add(comp);
}
catch (Exception e)
{
e.printStackTrace();
}
invalidate();
validate();
}
public void init()
{
// start up your progress bar
loadApplet("MyApplet");
}
}
> I have a largish applet with images
I. put ALL RESOURCES in different .zip file that you can download yourself. this solution works
II. you can try 'playing' with several archives with .class file. first .zip file will contain main AppletLoder class + some helper class (progress bar etc). second .zip file will contain the 'applet extension' class + everything else. main applet (AppletLoader) is supposed to trigger donwloading of the second .zip file with Class.forName(extensionCla ssName).
this works in IE, it seems that some (all ??) versions of NN download all the .zip files before instantiating the applet.
III. you can use two applets, inter-applet communication + JavaScript, but it'll be probably be quite tricky to make it working in all browsers ...
I. put ALL RESOURCES in different .zip file that you can download yourself. this solution works
II. you can try 'playing' with several archives with .class file. first .zip file will contain main AppletLoder class + some helper class (progress bar etc). second .zip file will contain the 'applet extension' class + everything else. main applet (AppletLoader) is supposed to trigger donwloading of the second .zip file with Class.forName(extensionCla
this works in IE, it seems that some (all ??) versions of NN download all the .zip files before instantiating the applet.
III. you can use two applets, inter-applet communication + JavaScript, but it'll be probably be quite tricky to make it working in all browsers ...
A request for a refund was made, however since the questioner did not do as instructed, it was denied. I need the experts to indicate a method of finalization. I will return in 72 hours. Thanks.
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It related to including just your progress bar in the main jar, and then loading 'real' main class using reflection.
This will mean the jar holding your application are not loaded initially.