diff options
author | Danesh Dadachanji <[email protected]> | 2011-12-19 15:00:03 -0500 |
---|---|---|
committer | Danesh Dadachanji <[email protected]> | 2011-12-19 15:00:03 -0500 |
commit | d6072b8d9141bdcc3e4be09671780054bad89432 (patch) | |
tree | 86cac0cea21e14d5fae9e28592079ebb065deef0 /netx | |
parent | 5c3817e37549b9c7fed1ec46a3956f7bdbc3c9d3 (diff) |
BasicService code does not work when placed in the applet constructor.
Diffstat (limited to 'netx')
-rw-r--r-- | netx/net/sourceforge/jnlp/Launcher.java | 13 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/runtime/AppletInstance.java | 14 |
2 files changed, 21 insertions, 6 deletions
diff --git a/netx/net/sourceforge/jnlp/Launcher.java b/netx/net/sourceforge/jnlp/Launcher.java index a9fa908..c1eda82 100644 --- a/netx/net/sourceforge/jnlp/Launcher.java +++ b/netx/net/sourceforge/jnlp/Launcher.java @@ -708,18 +708,19 @@ public class Launcher { ThreadGroup group = Thread.currentThread().getThreadGroup(); - String appletName = file.getApplet().getMainClass(); - Class appletClass = loader.loadClass(appletName); - Applet applet = (Applet) appletClass.newInstance(); - AppletInstance appletInstance; if (cont == null) - appletInstance = new AppletInstance(file, group, loader, applet); + appletInstance = new AppletInstance(file, group, loader, null); else - appletInstance = new AppletInstance(file, group, loader, applet, cont); + appletInstance = new AppletInstance(file, group, loader, null, cont); loader.setApplication(appletInstance); + String appletName = file.getApplet().getMainClass(); + Class appletClass = loader.loadClass(appletName); + Applet applet = (Applet) appletClass.newInstance(); + appletInstance.setApplet(applet); + setContextClassLoaderForAllThreads(appletInstance.getThreadGroup(), appletInstance.getClassLoader()); return appletInstance; diff --git a/netx/net/sourceforge/jnlp/runtime/AppletInstance.java b/netx/net/sourceforge/jnlp/runtime/AppletInstance.java index 78ab4f6..1f08817 100644 --- a/netx/net/sourceforge/jnlp/runtime/AppletInstance.java +++ b/netx/net/sourceforge/jnlp/runtime/AppletInstance.java @@ -52,6 +52,20 @@ public class AppletInstance extends ApplicationInstance { } /** + * Set the applet of this launched application; can only be called once. + */ + public void setApplet(Applet applet) { + if (this.applet != null) { + if (JNLPRuntime.isDebug()) { + Exception ex = new IllegalStateException("Applet can only be set once."); + ex.printStackTrace(); + } + return; + } + this.applet = applet; + } + + /** * */ public AppletInstance(JNLPFile file, ThreadGroup group, ClassLoader loader, Applet applet, Container cont) { |