Jme LwjglCanvas cast to Canvas

Hello all, I’m trying to implement a Jme Application in a swing Panel and some parts in the example wich is given makes me doubtful. Indeed, in the swing Canvas Test we found this line.



[java]JmeCanvasContext ctx = (JmeCanvasContext) canvasApplication.getContext()[/java]



Why are we forced to cast our JmeContext in JmeCanvasContext ?



I’ve want to do this directly :



[java]panel.add((Canvas)canvasApplication.getContext()); [/java]



But it’s give an error of conversion (Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException: com.jme3.system.lwjgl.LwjglCanvas cannot be cast to java.awt.Canvas)

You can’t cast it directly because LwjglCanvas does not extend Canvas. You must retrieve it as used in the example

Ok thanks .So it’s the only way to integer a JMonkey Window in a JFrame.