Hi there!
Im currently working on a multiplayer game. I wanted to use several (6, to be precise) dropDown controls to manage the clients
in my “lobby”-Screen. Everything works perfectly until i use more than 2 or 3 dropDowns (the exact number seems not to influence the crash).
I tried both xml and Java Builder to create the screen / dropDowns, in both ways the Logger output is the same.
I now tried the same with listBox. Same issue. It seems that nifty got problems creating this amount of controls at (nearly) the same time.
Even though the GUI crashes, the program itself seems to keep running.
My xml definition of “lobby”:
[xml]
<screen id=“lobby” controller=“client.GameClient”>
<layer id=“layer” childLayout=“center”>
<panel id=“panel” height=“400px” width=“350px” align=“center” valign=“center” style=“nifty-panel” childLayout=“vertical”>
<control name=“dropDown” id=“drop1” />
<control name=“dropDown” id=“drop2” />
<control name=“dropDown” id=“drop3” />
<control name=“dropDown” id=“drop4” />
<control name=“dropDown” id=“drop5” />
<control name=“dropDown” id=“drop6” />
</panel>
</layer>
</screen>
[/xml]
As soon as nifty.gotoScreen(“lobby”); is called, the GUI crashes with following output:
[java]
Aug 22, 2011 7:15:58 PM com.jme3.app.Application handleError
Schwerwiegend: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at de.lessvoid.nifty.elements.Element.canHandleInteraction(Element.java:1445)
at de.lessvoid.nifty.elements.Element.mouseEvent(Element.java:1376)
at de.lessvoid.nifty.screen.MouseOverHandler.processMouseEvent(MouseOverHandler.java:101)
at de.lessvoid.nifty.screen.Screen.forwardMouseEventToLayers(Screen.java:360)
at de.lessvoid.nifty.screen.Screen.mouseEvent(Screen.java:336)
at de.lessvoid.nifty.Nifty.forwardMouseEventToScreen(Nifty.java:245)
at de.lessvoid.nifty.Nifty.access$1300(Nifty.java:72)
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processEvent(Nifty.java:1344)
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(Nifty.java:1311)
at com.jme3.niftygui.InputSystemJme.onMouseMotionEventQueued(InputSystemJme.java:106)
at com.jme3.niftygui.InputSystemJme.forwardEvents(InputSystemJme.java:169)
at de.lessvoid.nifty.Nifty.update(Nifty.java:227)
at com.jme3.niftygui.InputSystemJme.endInput(InputSystemJme.java:94)
at com.jme3.input.InputManager.processQueue(InputManager.java:773)
at com.jme3.input.InputManager.update(InputManager.java:837)
at com.jme3.app.Application.update(Application.java:567)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:235)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:218)
at java.lang.Thread.run(Thread.java:722)
[/java]
Im sorry if i messed up anything posting the code or such. Im totally new here
Thank you in advance,
Cameo
As soon as nifty.gotoScreen(“lobby”); is called, the GUI crashes with following output:
Is it possible that you call that from another Thread or something? Where do you call it?
I've tried to reproduce this with 8 DropDown and it worked. Looking at the Stacktrace it seems like a Nifty element is called that is not initialized yet o_O Maybe you send the complete example that reproduces this?