Jframe insinde Appstate

Hello everybody,

I am searching for a solution but without results.
I would like to add a jframe to my AbstractAppState. When I do that in the conventional way my Application won’t be longer in fullscreen mode.
Is there a way to put a frame inside my JME scene?

I found something about the JME3 Canvas in a Swing GUI, but that is not what I need. I want a frame rendered inside my AbstractAppState.

Is there a way to implement this?

Well you could use the jfx embedding to use a swingnode in there to display your swing stuff.

But notice that the jfx part does not work compleletly in fullscreen.

I need the fullscreen.
Maybe I should explain what I am actually working at.

I have created a game which is controlled by an eyetracker.
Now i would like to add a feature which shows the useres current headposition, to make sure that the eyetracker can compute the gaze estimation.
This feature is called when the user moved to far. For testing i realized this with swing by painting on a panel.
Now jmonkey is giving me a hard time to add this to my game.

You might want to look at
com.jme3.texture.image.ImageRaster
it has a setPixel method similar to swing.
also there is some kind of util somewhere around the forum that allows to draw lines directly ect.

JFX embedding will work in fullscreen, I just need get back to it…

@abies said: JFX embedding will work in fullscreen, I just need get back to it...

So I tried the JFX. I have created a canvas with shapes and launched it from my JME AbstractAppState.
[java]javafx.application.Application.launch(BasicOpsTest.class);[/java]
It runs well.
But in fullscreen there is a problem. The app is still in fullscreen but the canvas does not appear. It is there, but it is not rendered. I can see it by the mouse icon. When I am at the center at the screen (where my canvas shoul be) the mouse icon changes.

How can I make it visible?

Fullscreen is currently broken in few ways. Is your canvas embedded in floating window or directly in the container scene? Also, please try restarting your app few times and see if it will help - there is also some kind of race condition, which causes picture to be not visible sometimes in full screen.

Fullscreen support requires some love - I will try to fix it, but not sure if I can do that before Sunday.

This is my Canvas:

[java]package gwap.alignment;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import javafx.scene.shape.ArcType;
import javafx.stage.Stage;

public class BasicOpsTest extends Application {

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Drawing Operations Test");
    Group root = new Group();
    Canvas canvas = new Canvas(300, 250);
    GraphicsContext gc = canvas.getGraphicsContext2D();
    drawShapes(gc);
    root.getChildren().add(canvas);
    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}

}[/java]

I restarted the app several times, but still the same issue.

Thank you for your help.
When you fix it, where do i can get the updated JME.jar to import it to eclipse?

@q-jack
Thats bit too much to expect from the embedding. You are not supposed to use javafx.Application. You need to use stage/scene from inside JmeFxContainer and make sure that all your components are getting from there. In your case, just do this part
[java]
Group root = new Group();
Canvas canvas = new Canvas(300, 250);
GraphicsContext gc = canvas.getGraphicsContext2D();
drawShapes(gc);
root.getChildren().add(canvas);
[/java]

and then call fxContainer.getScene().getChildren().add(root)

This will embed it directly on screen. If you need a floating window on top, this is the part which is currently only semi-working, but then you need to create Window class based on fxContainer stage. It was really tested only with things like popup windows etc - even then, it started to have issue after my latest changes to buffer layout.

@abies

Ok I understand. Thank for the hint.
But when you say call fxContainer.getScene().getChildren().add(root) I do not know what you mean with fxContainer.

Can you give me an short example?