javafx canvas like swing

I know canvas for swing and javafx are diferent things, but for swing I used to do something like

MyCanvas extends Canvas
{ Thread t;// and all that it comes after

@override
run()
{
render & update here
}

}//canvas

then u add that canvas to the JFrame, and set Jframe size, etc, after that u can show your game in the windows ( JFrame ) screen,

but for JavaFx canvas you have to get the context, like htm5 javascript games, then
can I extends JavaFx canvas and add a thread inside and just add to stage?

What happened when you tried doing exactly that?

I’m not sure I understand the question.

With JavaFX games, usually the best choice is to have an AnimationTimer class handle the update and render. Except, many render steps needed in Swing occur behind the scenes with JavaFX. You just change properties of the objects that have been loaded to the root group node.

you cannot add awt.Canvas to java FX stage, it have to be javaFX.Canvas

Maybe you can use a SwingNode to embed it, although I prefer not to do so and migrate to JavaFX instead of sticking with swing and AWT.

http://docs.oracle.com/javafx/8/embed_swing/jfxpub-embed_swing.htm

im looking how to adequate only the part of the render properly on Java FX, because I want those to be played on RPI devices so I have to maintain swing as well

OpenJFX will probably run on a Raspberry Pi in some time, the situation has been recently improved, it’s already packaged for Debian and it’s in progress for Redhat:
https://bugzilla.redhat.com/show_bug.cgi?id=1145303