Nifty GUI Frustrating Error

Hi! I’m new to NiftyGUI… I’ve been reading some things here at jmonkey forum as well as the Nifty Tutorials. I’ve been trying the demo as well… But I can’t seem to understand why it keeps giving me a NullPointer Exception… Here’s a very very very simple code that I’m doing…

[java]TextField textfield = nifty.getScreen(“hud”).findNiftyControl(“countryText”, TextField.class);

and I keep getting this error everytime I try to get something from the textfield

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main] java.lang.NullPointerException at de.lessvoid.nifty.controls.label.LabelControl.getTextRenderer( at de.lessvoid.nifty.controls.label.LabelControl.getText( at app.main.Main.simpleInitApp( at at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread( at at

Here’s my XML

[java]control height=“26px” id=“countryText” name=“textfield” width=“212px” x=“60” y=“0” maxLength=“20” text=“Some Text”[/java]

I’m also trying to do a setText(“Some Text”) and for some reason it keeps giving me NullPointerException… I’m getting really frustrated and I badly need help… :’(

For some reason the textfield isn’t being found. Make sure you have the right screen name as the nifty control name looks right.

It’s really hard to analyze the error trace only having some tiny code snippets.
But I guess the Nullpointer is thrown because your screen is not bound.
I cannot figure out another reason because the Nullpointer occurs in the class LabelControl.
I wonder why it is not the class TextFieldControl instead.
Actually the class LabelControl does not implement the interface TextField.