Can I use Textfields in nifty-popups?
yes
Okay this problem is solved^^ .
But now I got another one. I have this popup with two Textfields and a button. When I click on the button I want to read out the text standing in the texfields. the problem is I can´t reference the Textfields:
[java]public void bind(Nifty nifty, Screen screen) {
this.nifty = nifty;
this.screen = screen;
name1 = nifty.findPopupByName(“popupNamen”).findControl(“textfeldSpieler1”, TextFieldControl.class);
name2 = nifty.findPopupByName(“popupNamen”).findControl(“textfeldSpieler2”, TextFieldControl.class);
}
[/java]
when I start then I get this failure:
SCHWERWIEGEND: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at curlingxtreme.gui.MenuBildschirmController.bind(MenuBildschirmController.java:32)
at de.lessvoid.nifty.screen.Screen.startScreen(Screen.java:162)
at de.lessvoid.nifty.Nifty.gotoScreenInternal(Nifty.java:492)
at de.lessvoid.nifty.Nifty.gotoScreen(Nifty.java:460)
at de.lessvoid.nifty.Nifty.fromXml(Nifty.java:308)
at curlingxtreme.CurlingXtreme.simpleInitApp(CurlingXtreme.java:50)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:186)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:134)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:183)
at java.lang.Thread.run(Thread.java:619)
it looks right
try to find out what exactly is null? does findPopupByName() returns null or does findControl() does not find the textfield?
did you check for any tippfehler?
uhm, wait! you call that in your bind() method? why is this? are you sure you get the same nifty instance that has created the popups before?