JavaFX embedded in jme3

Problem is that this solution uses embedding API which got exposed only in java 8. Doing it in java 7 would require completely different solution, a lot more involved and less performant. There is probably exactly ZERO code which would translate between these two solutions. Of course, if somebody feels doing that, we could make it implement similar interfaces and let rest of Empire’s code work with either implementation.

Well it’s not possible betwen java 7 and java 8 version they figures, oh snap its shitty if it’s not possible to emulate events for unit tests.
The bridge kinda uses that newly created interface for that. With the java7 solution I tried earlyer it was impossible to push events in any way, cause the rootwindow requires focus for this (except move events they worked)

Also you need the texture types patch posted earlyer in this thread, if it is not yet into the svn.

@abies said: Problem is that this solution uses embedding API which got exposed only in java 8. Doing it in java 7 would require completely different solution, a lot more involved and less performant. There is probably exactly ZERO code which would translate between these two solutions. Of course, if somebody feels doing that, we could make it implement similar interfaces and let rest of Empire's code work with either implementation.

Ok sounds resonable :slight_smile:
I’m still at the beginning setting everything up and so.

I first need to get a hang of it, but I am aiming to document all the steps so at least we will have a nice readme which hopefully resulting in a working automated build script :slight_smile:

So I will use jdk 8 with the included javafx (in java 7, you need to basicaly install the javafx API separatly at least thats how I understand it)

will see where I end up

No, java 1.7u51 (which is included in the latest SDK installer) includes JavaFX

@normen said: No, java 1.7u51 (which is included in the latest SDK installer) includes JavaFX

You’re right first version came in with update 6 :slight_smile:

But as I am near to running the code on my machine I found out it realy needs the lates JavaFX as already mentioned and also the beta version must be newer than the beta 116 as mentioned in first post.

With 116 I got class not found on

com.sun.javafx.embed.EmbeddedSceneDSInterface and HostDragStartListener

which at least disapeared at the newest 129

However I still get one last compiler error at JmeFxContainer
in line 682

[java]
Map<Window, PopupSnapper> snappers = new IdentityHashMap<>();
[/java]

saying
“diamond operator is not supported in -source 1.5
(use -source 7 or higher to enable diamond operator)”
Even so I used Java Platform 1.8 strange… I will check that out tomorrow :slight_smile:

And also I found out that probably your gradle build scripts worked because you have the complete jmonkey source as projects in your local dev environment so there is no need to get them from a maven repo :slight_smile:

learned a bit of gradle today yay

@Heiko said: You're right first version came in with update 6 :)

But as I am near to running the code on my machine I found out it realy needs the lates JavaFX as already mentioned and also the beta version must be newer than the beta 116 as mentioned in first post.

With 116 I got class not found on

com.sun.javafx.embed.EmbeddedSceneDSInterface and HostDragStartListener

which at least disapeared at the newest 129

However I still get one last compiler error at JmeFxContainer
in line 682

[java]
Map<Window, PopupSnapper> snappers = new IdentityHashMap<>();
[/java]

saying
“diamond operator is not supported in -source 1.5
(use -source 7 or higher to enable diamond operator)”
Even so I used Java Platform 1.8 strange… I will check that out tomorrow :slight_smile:

And also I found out that probably your gradle build scripts worked because you have the complete jmonkey source as projects in your local dev environment so there is no need to get them from a maven repo :slight_smile:

learned a bit of gradle today yay

Check the about screen for what JDK you have installed, if you still have Java 1.7u4 then you need to download the new SDK installer. The Gradle build uses a nightly version of the engine and is already not compatible to the official release anymore and will break more in the near future, so I suggest not using it until 3.1 comes out.

YEs, the gradle build script is already waiting for the main switch of jme to gradle , then it can just be plugged there with its real id. (But you can use it without gradle just as well, after all its just a few source files)

Your problem is that the source compability is set, you can set a different level than your compiler supports, mainly used to support for example 1.5 on the source code when you have 1.7 installed. As the jfx parts uses java 1.8 anyway it makes not much sense for me to have a legacy source code level.

Before you spend too much effort implementing lightweight windows, please take a look at
http://jfxtras.org/doc/8.0/jfxtras/labs/scene/control/window/Window.html

I already did, I had some serious problems with getting them to run with java8 & the bridge ect.

I currently evaluate the possible options to solve this, eg how much work it is to write one vs. to bring their stuff to work, then I decide further, however no matter wich way I choose, the Window api should not change (much).

Hmm, I have just done a simple test
[java]
w = new Window(“My Window”);
w.setLayoutX(440);
w.setLayoutY(440);
w.setPrefSize(300, 200);
w.getLeftIcons().add(new CloseIcon(w));
w.getRightIcons().add(new MinimizeIcon(w));
w.getContentPane().getChildren().add(new Label(“Content… \nof the window”));
root.getChildren().add(w);
[/java]

and it worked out of the box. Are you using jfxtras labs 8.0-r1 snapshot?

I should be O.o
I will try again later this day, hopefully I just did something wrong.

Thx empire that was the problem, somehow the ide thinks jdk 5 is a cool default jdk but only for code compatibility.

I will now checkout jmonkey and build it localy for the patching for the format.

This is because jME is JDK5 compatible. This allows compatibility to a wider array of deployment options for example.

Ok everything set up and working :slight_smile:

Basic steps to get to the goal:
Set up local jmonkey Project.
install jdk 1.8 b129
apply patch: http://hub.jmonkeyengine.org/forum/topic/support-for-argb8-and-bgra8-textures/
change jdk and code version to 1.8

create new project from jfx sources
change jdk and code version to 1.8
add dependency to jmonkey engine project
add jme3:libraries from the dsk (for lwjgl etc)

Looking at it now it seems so easy :slight_smile:

Ok I did get the windows to run, but they are practiacally unusable for the usecase I try.

I have a content that requires a minimum size, and might also have a maximum one.

The window should contain s scrollpane, being used if the window size is to small for the minimum size of the content.
The content should be rescaled between minimum and maximum depending on the window size.
The window should not be resizable over the maximum size the content specifies.

Bonus, allow a property that forbids using the scrollpane, and instead vetos resizing if the window is below minimum size.

And a usecase for this?
Well for example a market window like this one from eve

I commited my tests, maybee anyone of you can spot if I’m missing something?

Else I will revert to my own window approach, since at least the veto stuff was working there correctly.

Try adding
[java]
this.innerScroll.setFitToHeight(true);
this.innerScroll.setFitToWidth(true);
[/java]
In AbstractWindow. You probably don’t need explicit HBarPolicy, because it is AS_NEEDED by default.

Then, between inner region min/max size and window prefsize you should be able to achieve all the things you have mentioned.

Edit:
And, for don’t-make-smaller property, you would need to link either innerScroll minSize or window minSize to whatever is the minimum. Possibly, set the scrollpane bar policy to NEVER, because otherwise they can appear at exactly wrong moment, even if content would fit without them.

1 Like

just did some testing and rewriting I am now able load any JavaFX Scene into the Monkey

And one of my old javaFX pages should do sth like that what you need

this is running in jmonkey:

I have no more time now I will explain more tomorrow

Ah great, that was the one I was searching for :slight_smile:

The size enforcing now works but for one bug :slight_smile:
I guess when the window is minimized and the minsize is enforced I need to unbind that value temporary, as else it cannot resize the border small enough :slight_smile:

But I’m think with another day or so and some polish it will work fine then, and I can finally go back to porting the gui’s i have to this.

I don’t know much javafx (yet) but this looks really promising, great work.

Hey guys…

I have some questions about how this will handle a few things: (Trying to keep up with the thread as best as possible)

  • UI component themes? Can you customize the L&F of windows, etc with custom images?
  • How does it handle scaling of these if so? i.e. a 9-patch is used in Lemur, tonegodGUI and Nifty to only stretch certain parts of the custom image.
  • Are font styles limited to solid color since they are actual fonts and not bitmap-based?
  • Can you adjust the alpha of the UI?

I actually have a bazillion questions, but these few might answer a bunch of the others.