JMEDesktop in applet

hi! I was trying to run the HelloJMEDesktop example in a applet, but I got this error when I click the mouse…

Exception in thread "AWT-EventQueue-1" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread

at java.awt.EventQueue.invokeAndWait(Unknown Source)

at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)

at com.jmex.awt.swingui.JMEDesktop.onButton(JMEDesktop.java:452)

at com.jmex.awt.swingui.JMEDesktop$ButtonAction.performAction(JMEDesktop.java:1174)

at com.jme.input.ActionTrigger.performAction(ActionTrigger.java:264)

at com.jme.input.InputHandler.processTriggers(InputHandler.java:426)

at com.jme.input.InputHandler.update(InputHandler.java:411)



does JMEDesktop can be run inside a applet? in that case… what special considerations must be taken? thks! 

I'm not sure of that either. I think you have to sigh your applet.

Hi!



Do this:


if(EventQueue.isDispatchThread())
      runnable.run();
else
      SwingUtilities.invokeAndWait(runnable);

related:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=11573.0

cesarpachon said:

hi! I was trying to run the HelloJMEDesktop example in a applet, but I got this error when I click the mouse..
Exception in thread "AWT-EventQueue-1" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
at java.awt.EventQueue.invokeAndWait(Unknown Source)
at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
at com.jmex.awt.swingui.JMEDesktop.onButton(JMEDesktop.java:452)
at com.jmex.awt.swingui.JMEDesktop$ButtonAction.performAction(JMEDesktop.java:1174)
at com.jme.input.ActionTrigger.performAction(ActionTrigger.java:264)
at com.jme.input.InputHandler.processTriggers(InputHandler.java:426)
at com.jme.input.InputHandler.update(InputHandler.java:411)

does JMEDesktop can be run inside a applet? in that case.. what special considerations must be taken? thks! 



See my post:
http://www.jmonkeyengine.com/forum/index.php?topic=5010.0