Posted by
William Bittle on
Feb 04, 2011; 4:22pm
URL: https://forum.jogamp.org/JOGL-Applet-invokeAndWait-Exception-tp2425308.html
I'm trying to test the deployment of my TestBed application as an applet and I get the following exception in the Console (I'm using Google Chrome, java 1.6.0_23 if this makes any difference):
Exception in thread "AWT-EventQueue-2" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
at java.awt.EventQueue.invokeAndWait(Unknown Source)
at com.jogamp.nativewindow.impl.jawt.JAWTUtil.<clinit>(JAWTUtil.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jogamp.common.util.ReflectionUtil.callMethod(ReflectionUtil.java:267)
at javax.media.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:199)
at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1090)
at javax.media.opengl.GLProfile.access$000(GLProfile.java:66)
at javax.media.opengl.GLProfile$1.run(GLProfile.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:109)
at javax.media.opengl.GLProfile.validateInitialization(GLProfile.java:1338)
at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1489)
at javax.media.opengl.GLProfile.get(GLProfile.java:548)
at javax.media.opengl.GLProfile.get(GLProfile.java:555)
at org.dyn4j.game2d.testbed.AppletDriver.start(AppletDriver.java:72)
at org.jdesktop.applet.util.JNLPAppletLauncher.startSubApplet(JNLPAppletLauncher.java:1991)
at org.jdesktop.applet.util.JNLPAppletLauncher.access$200(JNLPAppletLauncher.java:661)
at org.jdesktop.applet.util.JNLPAppletLauncher$5.run(JNLPAppletLauncher.java:1324)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I'm using the following html file (the commented portion is such so I can test deployment for those who dont currently support the Applet JNLP):
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
width="800"
height="600"
archive="
http://jogamp.org/deployment/util/applet-launcher.jar,
http://jogamp.org/deployment/webstart/nativewindow.all.jar,
http://jogamp.org/deployment/webstart/jogl.all.jar,
http://jogamp.org/deployment/webstart/gluegen-rt.jar,
http://jogamp.org/deployment/webstart/newt.all.jar,
http://www.dyn4j.org/TestBed/latest/dyn4j.jar,
http://www.dyn4j.org/TestBed/latest/dyn4j-TestBed.jar"> </applet>
With the last two parameters uncommented everything works great (I'm assuming because its ignoring everything but the last two parameters).
Code that might be relevant (AppletDriver class, removed comments for brevity):
public class AppletDriver extends JApplet {
@Override
public void start() {
super.start();
this.setFocusable(true);
Dimension size = new Dimension(800, 600);
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
// this extends GLCanvas
TestBed testbed = new TestBed(caps, this, size, TestBed.Mode.APPLET);
this.add(testbed);
if (this.isVisible()) {
this.requestFocus();
}
// starts the Animator
testbed.start();
}
}
You can test this at
http://www.dyn4j.org/TestBed/latest/dyn4j-TestBed.htmlSurely I'm doing something wrong here?