Reopening a screen with a ListBox

I just updated my svn to the latest version of jme3. I have a screen that contains a ListBox. When I try to launch the screen a second time using Nifty.goToScreen(), I get a NullPointerException. The funny thing is it only happens if I launch it the second time, it works fine when it is launched the first time. This behavior is new as it was working before I updated my svn.



When I switched to a DropDownBox, everything works as expected.



The specific error is:



[java]

SEVERE: Uncaught exception thrown in Thread[main,5,main]

java.lang.NullPointerException

at de.lessvoid.nifty.controls.listbox.ListBoxControl.applyWidthConstraints(ListBoxControl.java:304)

at de.lessvoid.nifty.controls.listbox.ListBoxControl.ensureWidthConstraints(ListBoxControl.java:284)

at de.lessvoid.nifty.controls.listbox.ListBoxControl.display(ListBoxControl.java:207)

at de.lessvoid.nifty.controls.listbox.ListBoxImpl.updateView(ListBoxImpl.java:42)

at de.lessvoid.nifty.controls.listbox.ListBoxImpl.changeSelectionMode(ListBoxImpl.java:81)

at de.lessvoid.nifty.controls.listbox.ListBoxControl.initSelectionMode(ListBoxControl.java:482)

at de.lessvoid.nifty.controls.listbox.ListBoxControl.bind(ListBoxControl.java:106)

at de.lessvoid.nifty.controls.NiftyInputControl.bindControl(NiftyInputControl.java:124)

at de.lessvoid.nifty.elements.Element.bindControls(Element.java:1704)

at de.lessvoid.nifty.elements.Element.bindControls(Element.java:1708)

at de.lessvoid.nifty.elements.Element.bindControls(Element.java:1708)

at de.lessvoid.nifty.screen.Screen.bindControls(Screen.java:752)

at de.lessvoid.nifty.screen.Screen.startScreen(Screen.java:192)

at de.lessvoid.nifty.Nifty.gotoScreenInternal(Nifty.java:587)

at de.lessvoid.nifty.Nifty.access$200(Nifty.java:70)

at de.lessvoid.nifty.Nifty$1.perform(Nifty.java:561)

at de.lessvoid.nifty.screen.Screen$EndScreenEndNotify.perform(Screen.java:600)

at de.lessvoid.nifty.screen.Screen$LocalEndNotify.perform(Screen.java:557)

at de.lessvoid.nifty.screen.Screen.startLayers(Screen.java:248)

at de.lessvoid.nifty.screen.Screen.endScreen(Screen.java:213)

at de.lessvoid.nifty.Nifty.gotoScreen(Nifty.java:558)

at test.nifty.Game.play(Game.java:171)

at test.nifty.Game.main(Game.java:294)

[/java]

I will check this later … now I need to go to work (I’m already late xD)

Yes, that’s a bug and it gave me headaches for the last 48 hours or so. I think I have found the problem tho. Some of the other new controls had problems too. This will now lead to a number of changes inside of Nifty which are not yet commited because I want to make sure that I don’t break anything. I’ll expect the change to be ready for svn tommorow evening (in my timezone that is :slight_smile: ) or next weekend. This will fix your ListBox issue here as weil (and some other problems too).



Just want to give you an update that the issue is not forgotten (… instead it’s top priority because it’s really a show-stopper for 1.3)

1 Like

Awesome @void! Thanks for your hard work. The nifty library is looking pretty good.



I wrote a couple of tutorials on Nifty GUI, based on the *builder classes for UI creation as well as 1.3 controls. I would like some comments as I don’t want to use it in the wrong way. If you have time, please take a look at http://env3d.org/beta/lessons and scroll down to “Part III, Lesson 4”.

1 Like

I’ve commited everything. The next Nifty (!) nightly build should solve that issue.



@batkid: The tutorials look pretty great! :slight_smile: Maybe add a couple of screenshots too? Besides that I can’t spot any mistakes. Nice work!

(Maybe you can help improving the Nifty wiki at sf.net too? :D)

Thanks @void256. Do you know when the snapshot will be incorporated into the jME3 svn? I just updated and the fix is not there yet.



Let me know if you have any specific tutorials in mind that you would like me to help with.

Hopefully when Nifty 1.3 is done! I’m currently mainly fixing issues that are reported and the only missing feature that is scheduled is a radiobutton.



If you want to help with the Nifty wiki as well, then I’ll need your sf.net username. The more people helping the better :slight_smile:

With bugs getting fixed so quickly we might as well just grab nifty from SVN and use that for each of the jME3 nightly builds :slight_smile:

I’m currently mainly fixing issues that are reported and the only missing feature that is scheduled is a radiobutton.

_________________

Cheap RS Gold

Buy Runescape Gold

World of Warcraft Items

Just updated to the latest svn of jME3 and nifty is now working great. Thanks!



One question: how do you turn off the logging output? I tried:



[java]

Logger.getLogger(“de”).setLevel(Level.SEVERE);

[/java]



but it doesn’t work. All the INFO level messages are still being printed out.