Javafx8 and SwingNode


I have been trying to get a jme3 canvas inside a javafx window using SwingNode from JavaFX8 as a test before proceeding with an application.

The problem I have at the moment is that the canvas is not displaying, but the other swing object (a button) is and working fine. To be more correct there is a blank space where the canvas would be, and the swing button to the right as it is in the SwingCanvasTest

Does any one have an idea of what I am doing to make this fail?

I have this code based on a swing canvas example,


public class Jme3fx extends SimpleApplication {

public static JPanel	panel = new JPanel(new FlowLayout());

public void simpleInitApp() {
	// activate windowed input behaviour
	// display a cube
	Box boxshape1 = new Box(new Vector3f(-3f, 1.1f, 0f), 1f, 1f, 1f);
	Geometry cube = new Geometry("My Textured Box", boxshape1);
	Material mat_stl = new Material(assetManager, "Common/MatDefs/Misc/ColoredTextured.j3md");
	Texture tex_ml = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
	mat_stl.setColor("Color", ColorRGBA.Blue);

public void makeitgo() {
	//panel = new JPanel(new FlowLayout()); // a panel
	java.awt.EventQueue.invokeLater(new Runnable() {			
		public void run() {
			// create new JME appsettings
			AppSettings settings = new AppSettings(true);
			// create new canvas application
			Jme3fx canvasApplication = new Jme3fx();
			canvasApplication.createCanvas(); // create canvas!
			JmeCanvasContext ctx = (JmeCanvasContext) canvasApplication.getContext();
			Dimension dim = new Dimension(640, 480);

			panel.add(ctx.getCanvas());                  // add JME canvas
	//return panel;

 * @return
public JComponent getPanel() {
	// TODO Auto-generated method stub
	JButton button = new JButton("Swing Component");
	button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e)
            //Execute when button is pressed
            System.out.println("You clicked the button");
	return panel;



and this code to display it in a FX window


    jmeapp = new Jme3fx();

private void createAndSetSwingContent() {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {


have you had any luck trying to get this done?

If you just want to have jfx inside jme there is an integration for that

If you need it the other way round, it should tehoretically work with the awt frame, after all from the swing side it’s only a bufferdimage

I don’t think it is possible to repaint heavyweight component like JmeCanvas in JavaFX 2.0.

“The hierarchy of components contained in the JComponent instance should not contain any heavyweight components, otherwise SwingNode may fail to paint it.”