From baa88fe536b0b8a70cadabe5412120a9168dec11 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 15 Sep 2011 13:26:06 +0200 Subject: JOGLNewtAppletBase: Use proper context ClassLoader; Add ElektronenMultiplizierer (NEWT Applet Runner) --- .../jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/newt/classes') 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>() { + 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)) { -- cgit v1.2.3