JavaFX embedded in jme3

TextInputDialog dialog = new TextInputDialog("");
dialog.initOwner(guiManager.getjmeFXContainer().getStage());

does not embed the Dialog in the embedded-stage, it open a another window. With a non-embedded stage away from jme it works. The problem is known?

It isn’t dialog, it is pane in embedded scene.


How do I change the z-order?
My GUI node:

I resolved this problem :smile:
I added after UI initialization this code:
getGuiNode().getChildren().forEach(spatial → {
if (spatial instanceof JavaFXPicture) {
spatial.setLocalTranslation(0, 0, 100);
} else {
spatial.setLocalTranslation(0, 0, 0);
}
});

Well a dialog opens a own native window, there is no way to supress this.

I suggest using the Window classes provided and build your own dialog instead.

Hy there,
iam using the javafxHuds and figured out some kind of problem these days.
I got ComboBoxes in my HUDs.
When i open the combo the listview is shown kind of “behind” my application
With use of two monitors i can see it when i click on the second screen (JME App flickers then)
Looks like kind a “Repaint,refresh” prob

There is a known issue with dropdowns I believe, I have the same issue. Not really sure where this issue lies though. I think this might be the issue for it: Popups not being snapped correctly whilst fullscreen · Issue #32 · empirephoenix/JME3-JFX · GitHub

Hy thanks for the issue-Info.
I set the application to fullScreen(false) but could not achieve the right expected behaviour.
I figured out that it is caused when i use the full width of my Monitor.
If i reduce the application width to MainScreen width -1 pixel it is kind of a workaround for this issue.
No matter if i use just one Monitor or two of them…

Maybe this info can help others too :smile:

Hi everyone,
I am currently working on a game with Jme3 and i have found this amazing works about Javafx.
But i have a problem. How can i use your library to not use at all FXML ? In your package, all exemple use FXML but i prefer using code line instead ? Is it possible and how ?

EDIT : Ok i have found how to do that. but i still have one question : is there a better method to do that than each time write this for exemple :

Platform.runLater(() → testguiManager.getRootGroup().getChildren().add(new StackPane()));
Platform.runLater(() → ((StackPane)testguiManager.getRootGroup().getChildren().get(0)).getChildren().add(new Button(“test”)));

I don’t understand your question. The rule is to run code related JavaFX into JavaFX Thread. When you don’t know what is the current Thread, wrap every code related to JavaFX into

Platform.runLater(() -> {
... javafx code
});

Idem for jme, eq on a click on a JavaFX Button :

jmeApplication.enqueue(()-> {
... jme code (eg change Node, add appstate,...)
});

I have just understood. Thank you ! It is an excellent work. I Hate nifty and this will help me a lot.

You can of course put larger parts into the jfx runnable, like creation for whole ui’s or similar, no need to wrap everything.

Take a look at JME3-JFX/TestDragDrop.java at master · empirephoenix/JME3-JFX · GitHub as well, it is not fxml based.

innerinit is in the hud and the window classes, and you can just add your own stuff there.
Of course this will only simplfy the creation, if you later addd stuff, you still need to use platform run later everywhere.

Hi guys,

when I release the focus ( getjmeFXContainer().loseFocus() ) and one javafx element is still visible, the key-events will correctly delivered to jme, not the mous-events too. The mouse-events will anyway delivered to javafx. Someone understand me?

** Ok there was a gridpane with not full transparency, which has blocked. **

Hu guys,

I have a problem concerning the focus. I have made a HUD for the game.
It’s a game in FPS view and when my cursor arrive on HUD, the camera stop moving. Jme events are inscreased.
I have noticed that when i clear rawmapping it works well.
Is there an easier method than enable/disable event each time ?

I’m not exactly sure what you mean.

Mouseevents are either send to jfx or jme depending on the transparency of the jfx hud.
Keyboard events are send to jme, except a jfx component has focus, however this parts are a but ugly. Since it is not possible to sent jme synthetic events currently, it is not possible to send events not processed by jfx back to jme.

There is the possibility to set a eventlistener in the guimanager, that is notified by all events, no matter if they are also send to jfx.

Does this help? If not, please try to explain your problem more.

Ok, i think i have understood what you say. But i will explain better with image. It will be more easier to understand.


This is the interface of my editor. When i click on the middle button of my mouse, i make disapear the cursor and i can move the camera. When i move my cursor and i go on the hud, my camera doesn’t move anymore. I have notice that when i delete rawmapping, it works well but is there a better way than enable/disable the javafx events each time ?

Other question relative to popup menus like menubar, colorpicker, combobox, etc… It seems these components don’t work in fullscreen. Is it normal ?

Some components are a bit problematic, mostly all that open a new undecorated window.
I rarely use fullscreen, you could try to set the lwjgl hidden switch for undecorated window and try a fullscreen window instead.

I use a similar logic you do (just with the tab key), what do you use to turn the mouse? how do you make it dissapear?
In my game it works without problems so far.

I have a similar problem to this one. I too click and hold the middle mouse button to rotate the camera, however even thought I hide the cursor, it’s like the cursor is still moving and events are being sent and if the cursor then happens to enter the area of a JavaFX component on the hud and I then release the middle mouse button the event is eaten by the jme-jfx inputlistener and therefore my camera keeps moving and the cursor remains hidden. It’s on my todo to have a look at the jme-jfx input listener code and see if we could possible add a way of telling it to ignore all events so that the camera movement can happen and then toggle the ignore flag off once done. I don’t know if this would be the best way of doing it but I’m sure we can figure something out.

I think I have added a event for the focus transition, so you can manually do the logic.

An addition to shortcircuit the jfx part would be nice, it should be somewhat straigtforward.

Hi, it’s me again. I have another problem more anoying… I think that Javafx shapes don’t work with your library… When i try on a simple project, it works but when i try on my project, i don’t see anything and i have this message on the console :
oct. 11, 2015 2:07:37 PM javafx.scene.shape.Mesh
AVERTISSEMENT: System can’t support ConditionalFeature.SCENE3D
I hope there is a solution because i absolutly need that for my game…