JME in swing Canvas as Applet


I saw that jmonkey applet is possible to run;

But if it possible to build applet with swing and inside swing place jme canvas??


Not really with the normal applet solution and its generally a bad idea as it gives you headaches with threading, combination of ui elements and non-portability. If its just because it seems easier to do the gui in swing cause you got a drag & drop editor… don’t do it.

heh you got it! Because it’s seems for me easier do gui in swing rather than in jmonket but I’m learning now and the best solution would be learning in right way. Your bold “don’t” is with a reason I assume. Is it impossible or it is bad idea only?

I would like to do simple applet game where players action will be only by clicking button and I thought that easier would be create this button in swing.

I have tried do samething in eclipse. I have working applet with JME canvas in swing

and when I tried to run this as applet from browser there is error

Well I stated my reasons for this recommendation, its possible but in the end as much of a “headache” than learning nifty… You have to enqueue calls to swing and gl. If you manage to get a decent MVC model going then that should be possible however that leaves you with the other issues: Non-portability - swing/awt doesn’t work on android for example and mind you its becoming a desktop os too.

Combination of ui elements - you will want icons made from world stuff and probably mouse-movable 3d objects in the world etc… Given its two separate threads (swing EDT and the update loop) you will have major headaches getting all this properly thread-safe and synchronized. I know what I am talking about as the SDK is a swing app but in that case there exists a reason for the combination (the IDE and engine are to be combined :)).

This applet won’t be that much complicated. The animations are very simple and the main reason I use JME is because it is easy to implement them from Blender. The user will not have any access to JME window. The animations will be launched by the buttons in swing and then played in JME. Even I could play short movies instead of animations but I don’t want to do that from obvious reasons. The applet is designed only for web browsers so non-portability is not a problem for me either.

But a few buttons in nifty is also not hard :wink: