hello, i cant dispose a popup, why?
the method disposeExitPopup is called and the background of the screen gets brighter (something happens) but the the panel with the buttons
is still visible.
after clicking again on the disposeExitPopup button im getting the exception:
[java]
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.remove(ArrayList.java:390)
at de.lessvoid.nifty.controls.FocusHandler.popState(FocusHandler.java:163)
at de.lessvoid.nifty.screen.Screen$ElementWithEndNotify.remove(Screen.java:800)
at de.lessvoid.nifty.screen.Screen.processAddAndRemoveLayerElements(Screen.java:569)
at de.lessvoid.nifty.Nifty.removeLayerElements(Nifty.java:312)
at de.lessvoid.nifty.Nifty.handleDynamicElements(Nifty.java:293)
at de.lessvoid.nifty.Nifty.access$1400(Nifty.java:72)
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processEvent(Nifty.java:1345)
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(Nifty.java:1311)
at com.jme3.niftygui.InputSystemJme.onMouseButtonEventQueued(InputSystemJme.java:128)
at com.jme3.niftygui.InputSystemJme.forwardEvents(InputSystemJme.java:171)
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:662)
[/java]
code:
[java]
public void showExitPopup() {
exitPopup = nifty.createPopup("popupExit");
nifty.showPopup(screen, exitPopup.getId(), null);
}
public void disposeExitPopup() {
nifty.closePopup(exitPopup.getId());
nifty.getCurrentScreen().layoutLayers();
}
[/java]
xml:
[xml]
<popup id="popupExit" childLayout="center" backgroundColor="#000a">
<panel width="40%" style="nifty-panel" childLayout="vertical" align="center" valign="center">
<text align="center" font="Interface/Fonts/ArialBlack16.fnt" text="Sure?" />
<panel id="seperator" height="5px" align="center" childLayout="horizontal" />
<panel align="center" childLayout="horizontal" >
<panel width="50%" align="center" childLayout="center" >
<control valign="center" align="center" name="button" label="yes">
<interact onClick="exit()" />
</control>
</panel>
<panel width="50%" align="center" childLayout="center" >
<control valign="center" align="center" name="button" label="no">
<interact onClick="disposeExitPopup()" />
</control>
</panel>
</panel>
</panel>
</popup>
[/xml]
failure: onClick is called twice, but why?
That looks like the crash i had here: http://hub.jmonkeyengine.org/groups/gui/forum/topic/nifty-applet-close-popup-menu-crash-old-nifty-version/
ive updated to 1.3.1 (default controls and nifty) but getting still the same behaviour