Canvas doesn’t show

When I use this code to embed a canvas in a swing window the canvas doesn’t show. Why is this?

The code is within a runnable that is in the main class and ImprovedSceneWindow creates the Gui, Screen is a jPanel.

[java]

wind = new ImprovedSceneWindow();

Dimension dim = new Dimension(wind.Screen.getSize());



AppSettings settings = new AppSettings(true);

settings.setHeight(dim.height);

settings.setWidth(dim.width);



Final WindowLuaTest WindowLuaTest = new WindowLuaTest();

WindowLuaTest.setSettings(settings);

WindowLuaTest.setPauseOnLostFocus(false);

WindowLuaTest.createCanvas();



JmeCanvasContext ctx = (JmeCanvasContext) WindowLuaTest.getContext();

ctx.setSystemListener(WindowLuaTest);

ctx.getCanvas().setPreferredSize(dim);



wind.Screen.add(ctx.getCanvas());

WindowLuaTest.startCanvas();

wind.setVisible(true);[/java]

Oh I found the problem, I have to use resolutions like 640x480… Is there any way around this? I want the canvas to be resizable you see?

The render output is always the size of the canvas, don’t change the default settings but resize the canvas by normal swing means.

1 Like