I have the pleasure to announce a new feature in jME: With JMEDesktop you can now use Swing components as in-game GUI. While there is still work to do (e.g. memory optimization) you can already have a look at TestJMEDesktop.
Advantages compared to other 3D gui kits:
All known widgets available
Standard Swing-GUI-builders can be used
Look&Feels (even Synth works)
Known Shortcomings:
Swing imposes a lot of overhead
Component.requestFocus has no effect (e.g. Tab key to change focus does not work yet)
Typematic rate not regarded (no repeating keystrokes while holding key etc. yet)
JScrollPane needs repainting in JDK1.4 (see TestJMEDesktop source)
Heavyweight components are not/incompletely drawn (e.g. internal frame title bars on macosx theme)
I tested this on many systems, however, because it is quite VM-dependent, please report any issues here.
i've allways had(and still have) a problem with that TestJMEDesktop hangs after a short while, or after pressing some button…running jdk 1.5.0_05…can't put my finger on what it is, gonna check further…
Hey, nobody said it does not work at all for him until now
Only MrCoder makes me a bit concerned about that hanging - is it temporary or is the VM hung forever?
@Galun: half transparent? sure! - just do it like that text node
html-links: I don't know if I find the time to look at it soon. Most probably some mouse events are fired different by JMEDesktop than by a normal Swing Window. You can add a awt event listener at the toolkit and compare the event within your applet and in jME to get a clue…
Does anyone know what this is or how to resolve it?
org.lwjgl.opengl.OpenGLException: Invalid value (1281)
at org.lwjgl.opengl.Util.checkGLError(Util.java:56)
at com.jmex.awt.swingui.LWJGLImageGraphics.update(Unknown Source)
at com.jmex.awt.swingui.ImageGraphics.update(Unknown Source)
at com.jmex.awt.swingui.JMEDesktop.draw(Unknown Source)
at com.jme.renderer.RenderQueue.renderTransparentBucket(Unknown Source)
at com.jme.renderer.RenderQueue.renderBuckets(Unknown Source)
at com.jme.renderer.Renderer.renderQueue(Unknown Source)
at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(Unknown Source)
at com.jme.app.BaseGame.start(Unknown Source)
at com.mw3d.gui.test.TestJMEDesktop.main(TestJMEDesktop.java:74)
The swing stuff is rendered, but as soon as I hover or click on a button I get that error.
That sounds like a problem with updating parts of the texture. Maybe that card supports only specific region sizes to update. I have added a fallback to updating the whole desktop each time it is drawn - please test if this helps. This makes painting quite slow on those cards but should keep functionality (a warning is printed and e.g. dragging frames around gets slow).
Now, can one set a swing component to be transparent? Apply a alpha state to it?
As you see on the screenshot above - you can :)
But obviously alpha states cannot be assigned to components ;) - just normal swing transparency.
But if your components are not transparent themselfes you can do something like
just wondering but could this be used like the gui in doom 3?
Hah, yeah I thought exactly that same when I started the test demonstration of it! :D
Judging by the demonstration, I can't see why it couldn't be used like they do in Doom 3. It might even be pretty easy to implement once the last bugs are cleared out. I'd also be easy to make a 3D-ish game menu with it by using some rotation and translation like in the demonstration :)