Hi there,
I have my little question for you guys. I wonder if there is any possibility I can use AWT/Swing components in a jME App (instead of Nifty GUI). I saw a tutorial on how to use a jME app in a Swing/AWT canvas. Any help on that would be much apreciated since I just can`t get to work well with Nifty.
Swing is far too slow to try and use inside JME app. Using the JME canvas inside a swing window works fine though, I’ve done it. Just follow the tutorial…
@zarch said:
Swing is far too slow to try and use inside JME app. Using the JME canvas inside a swing window works fine though, I've done it. Just follow the tutorial...
But isn`t this used for creating controls outside the game? Like a level editor as stated in the tutorial? I need to use it just like Nifty. For the GUI system.
- If doing GUI inside the JME screen - you can’t use Swing.
- If going GUI outside the JME screen embedding JME as a canvas - you can use Swing.
I don’t really understand what you are asking.
Well, the number 1 of your response answered my question. Thanks :).
Any other possibilities of creating a GUI inside the JME screen other than Nifty?
Yeah, there is at least one:
You draw everything by yourself and do the input handling by yourself.
Pro: Full control, Contra: Difficult and time consuming^^
@zarch said:
1. If doing GUI inside the JME screen - you can't use Swing.
You can actually override the paint methods and draw to a texture on a quad.. No big deal there. You can also send the input to Swing. If you search around on the forums someone started a project with this about 2 years ago.. It started as a proof of concept and pretty much remained as such.
A member of java-forum.org does Swogl. It renders Swing with LWJGL but you would have to dive into the renderers of jME to use this library I guess.
http://www.javagl.de/
For all such experiments remember that a) they definitely do not work on all platforms the same and b) even Oracle now favors the JavaFX API for UI. To go with a jme3 compatible UI that will work on all jme3-supported platforms use Nifty GUI.
I’ve been twitching to somehow get JavaFX “on top of”/“in” jME because that’s what Oracle is pushing so hard. I just can’t be bothered, the technology isn’t that interesting to me