UIWindowManager HELP

I tested the SWING tute “SwingFPSCounter” and i’ve an error :

java.lang.NullPointerException
at com.xith3d.userinterface.UIWindowManager.calcImagePlate(UIWindowManager.java:204)
at com.xith3d.userinterface.UIWindowManager.(UIWindowManager.java:137)
at SwingFPSCounter.(SwingFPSCounter.java:131)
at SwingFPSCounter.(SwingFPSCounter.java:112)
at MsaEngine.(MsaEngine.java:219)
at AppLauncher.(AppLauncher.java:15)
at Engine.main(Engine.java:26)
Exception in thread “main”

Thanks for help :slight_smile:

Does the Xith Gui test work for you?

http://xith.org/jws/jws-com.xith3d.test.Xith3DGuiTest.jnlp

I use UIWindow in my game and the only problem I have so far is that the text gets squished and ugly when you dont run full screen.

Maybe give us a code example.

I had the same problem with the deformation of the text when not running fullscreen. However, a quick and dirty fix is putting the canvas inside a JPanel in a JFrame, eg:


Dimension d = new Dimension(800, 600);
JFrame mainWindow = new JFrame("Xith3D");
JPanel panel = new JPanel();
panel.setPreferredSize(d);
panel.setMaximumSize(d);
panel.setMinimumSize(d);
mainWindow.getContentPane().add(panel);
mainWindow.pack();
mainWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
mainWindow.setLocation(100,100);
RenderPeer renderPeer = new RenderPeerImpl();
CanvasPeer canvasPeer = renderPeer.makeCanvas(
                              panel,
                              d.width,
                              d.height,
                              16,
                              false);

The canvas will not resize with the window, but at least you get a window that can be moved and closed.

Terje

Auh, excellent. I will have to give that a try tonight. Thanks.

OK, i find the problem :slight_smile:
That simple, i try to add my HUD before to add canvas to my VIEW.

BEFORE:

SwingFPSCounter counter = new SwingFPSCounter(canvas);
view.addCanvas3D(canvas);

NOW:

view.addCanvas3D(canvas);
SwingFPSCounter counter = new SwingFPSCounter(canvas);

AND WORK FINE BYE :slight_smile:

I would suggest you to add a feature request (with a test case) in Xith3D Issuezilla, so we do not forget to add such check in next versions of Xith3D.

Yuri