diff options
author | Sven Gothel <[email protected]> | 2011-09-15 13:26:06 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-15 13:26:06 +0200 |
commit | baa88fe536b0b8a70cadabe5412120a9168dec11 (patch) | |
tree | ad76ec6b15e41bbfbdba1e51fc5604bbe63393c7 /src/newt/classes | |
parent | 42129070c5262c7f6c881c41a70fcb4550c33efa (diff) |
JOGLNewtAppletBase: Use proper context ClassLoader; Add ElektronenMultiplizierer (NEWT Applet Runner)
Diffstat (limited to 'src/newt/classes')
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java index 97142b32b..9d3b8185f 100755 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java @@ -1,6 +1,8 @@ package com.jogamp.newt.awt.applet; import java.lang.reflect.*; +import java.security.AccessController; +import java.security.PrivilegedAction; import javax.media.nativewindow.NativeWindow; import javax.media.opengl.*; @@ -56,11 +58,22 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo return def; } - public static GLEventListener createInstance(String clazzName) { + public static GLEventListener createInstance(final String clazzName) { Object instance = null; try { - Class<?> clazz = Class.forName(clazzName); + final Class<?> clazz = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() { + public Class<?> run() { + final ClassLoader cl = Thread.currentThread().getContextClassLoader(); + Class<?> clazz = null; + try { + clazz = Class.forName(clazzName, false, cl); + } catch (Throwable t) { + t.printStackTrace(); + } + return clazz; + } + }); instance = clazz.newInstance(); } catch (Throwable t) { t.printStackTrace(); @@ -97,9 +110,13 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo } public void init(ThreadGroup tg, GLWindow glWindow) { + isValid = false; this.glWindow = glWindow; glEventListener = createInstance(glEventListenerClazzName); + if(null == glEventListener) { + return; + } try { if(!setField(glEventListener, "window", glWindow)) { |