Hello all,
EDIT: maybe related to http://www.jmonkeyengine.com/jmeforum/index.php?topic=6287.0 ?
I used some RubiksCube class found in the forum at http://www.jmonkeyengine.com/jmeforum/index.php?topic=6478.0.
I now try to customize it by adding a JMEDesktop on top of the window, thus showing regular Swing controls/debug infos.
This is for a thesis project and want to keep it as “clean” as possible, that is by not using fancy 3D things and still allow simple raw data display.
My problem is that i create a yellow transparent desktop, put it on top of the window, try to add a javax.swing.JFrame but it is not visible?!
Code that might cause problem :
protected void simpleInitGame() {
// removed code for reading, see 7z file !
// create a node for ortho gui stuff
guiNode = new Node("gui");
guiNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
// move the 'default' keys (debug normals, toggle lighting, etc.) to a separated input handler
InputHandler handlerForDefaultKeyActions = input;
// remove the first person nested handlers
handlerForDefaultKeyActions.removeAllFromAttachedHandlers();
// create a new handler for our input
input = new InputHandler();
// add the default handler as a child
input.addToAttachedHandlers( handlerForDefaultKeyActions );
// Create 3D desktop and attach it to the gui node
final JMEDesktop desktop = new JMEDesktop("desktop", 1280, 100, input);
desktop.getLocalTranslation().set(display.getWidth() / 2, display.getHeight(), 0);
guiNode.attachChild(desktop);
// perform all the swing stuff in the swing thread
// (Only access the Swing UI from the Swing event dispatch thread!
// See SwingUtilities.invokeLater()
// and http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html for details.)
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// Set desktop style
desktop.getJDesktop().setBackground(new Color(1, 1, 0, 0.2f));
// Create frame and attach it
final FrameControls controlPanel = new FrameControls();
desktop.getJDesktop().add(controlPanel);
controlPanel.setLocation(200, 200);
controlPanel.setSize(1000, 1000);
controlPanel.setVisible(true);
}
});
// don't cull the gui away
guiNode.setCullMode(SceneElement.CULL_NEVER);
// gui needs no lighting
guiNode.setLightCombineMode(LightState.OFF);
// update the render states (especially the texture state of the deskop!)
guiNode.updateRenderState();
// update the world vectors (needed as we have altered local translation of the desktop and it's
// not called in the update loop)
guiNode.updateGeometricState(0, true);
// finally show the system mouse cursor to allow the user to click our button
MouseInput.get().setCursorVisible(true);
}
Full sources are @ http://umh.dullier.be/rubiks/BaseRubiks_20080216_2048.7z
Thanks!

