LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: caster on May 26, 2011, 04:38:04

Title: Applet
Post by: caster on May 26, 2011, 04:38:04
Hello,

How to restart AppletLoader after the applet has started?

Thanks you
Title: Re: Applet
Post by: Matzon on May 26, 2011, 08:29:28
why would you want to restart it?

otherwise ... press f5
Title: Re: Applet
Post by: kappa on May 26, 2011, 08:53:00
Quote from: Matzon on May 26, 2011, 08:29:28
otherwise ... press f5

If you want to be a bit more fancy and do it programmatically, then use the following to refresh the page.

Quoteapplet.getAppletContext().showDocument(applet.getDocumentBase(), "_self" );
Title: Re: Applet
Post by: pjohnsen on May 27, 2011, 10:13:37
If you don't want to reload the whole html page, you can use JavaScript (e.g. with jQuery), to recreate the applet tag.
Title: Re: Applet
Post by: caster on May 27, 2011, 10:25:55
Thank you for your help

I use Jmonkeyengine3 and I would like download jars after the appletLoader has started

my code in appletloader

       EventQueue.invokeAndWait(new Runnable()
      {
               public void run()
               {
               try
               {
                  switchApplet();
               } catch (Exception e)
               {
                  fatalErrorOccured("This occurred while '" + getDescriptionForState() + "'", e);
               }
               setState(STATE_DONE);
               repaint();
               }
          });
         
          download2();

the download2() run but when the child applet start the classloader of download2() is missing!

Thank you
Title: Re: Applet
Post by: kappa on May 27, 2011, 10:36:46
hmm, why do it in the appletloader code then?, since once you've passed the switchApplet() your essentially running the loaded applet. So you should do it in your own game code if you need it after that point.

Odd though that you'd need to download files at that point ? why not just get the appletloader to download the jars initially by specifying them in the html code?
Title: Re: Applet
Post by: caster on May 27, 2011, 10:54:19
Yes sorry it's not LWJGL

but how to downlaod after this point

I don't understand, when I download other jar after appletLoader the classLoader is missing
It's possible to update the classLoader or other?

Thank you
Title: Re: Applet
Post by: pjohnsen on May 27, 2011, 15:29:26
AppletLoader does some magic with the classloader (to handle natives and permissions).

But you can add jars to be downloaded in al_jars parameter (see http://lwjgl.org/wiki/index.php?title=Deploying_with_the_LWJGL_Applet_Loader_1_-_Basics)

Or you can load stuff from your own applet as mentioned, i.e. in it's ctor or init, as it will be running with a properly configured classloader.