I’m currently trying to display a Canvas in a JFrame window. I’m retrieving context of my SimpleApp and use the Canvas.startCanvas() function. The game is running because I can see the console answer to action, but the Canvas doesn’t display in the window.
Any idea what’s going on?
Check your layout, a BoxLayout is probably best.
I’m using an AWT canvas directly in the JFRAME ( in GUI designer ) that I set as my game canvas. You say that I should put the canvas in a BoxLayout to prevent it from disappearing?
that you set? you get a canvas from the application that you then attach to your window, yes. Read up on AWT/Swing layout.
I took example of the tutorial on Canvas and I did pretty much the same thing.
AppSettings settings = new AppSettings(true);
JmeCanvasContext ctx = (JmeCanvasContext) main.main.myGame.getContext();
Dimension dimm = new Dimension(536, 566);
GameCanvas = ctx.getCanvas();
Where GameCanvas is an AWT canvas already placed/sized in my JFrame. Any idea why the canvas isn’t showing up? It’s up and running 'cause I see the systemPrint() in console when I press an action button.