Nifty GUI - Problem detecting Mouse Input

Hello,
I’m having some trouble to detect the mouse input on nifty GUI.
The thing is, i’ve done a Menu with some options, and it works fine, it recognize when i click on NovoJogo(NewGame) button, and load the game, and chage appStates etc… But now i’m trying to create a pause screen, that will pause the game, and show a pause screen with some options, i could do this part, the appState is Pausing, and the screen is changing from HUD to Pause Screen, BUT i put a label with a <interact onRelease=“unpause()”> on XML, the same as i’ve done at the MenuScreen, but it don’t work… it do not call the function to unpause the game.
1 - i’ve attached the screenControl to the stateManager, as much as the initialize method is called.
2 - i’ve set a PauseAppState to do the dirt thing…

here is the PauseAppState.java:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package HdI.AppStates;

import HdI.ScreenControls.PauseScreenControl;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.niftygui.NiftyJmeDisplay;

/**
 *
 * @author Paulo
 */
public class PausedAppState extends AbstractAppState {
    
    SimpleApplication app;
    
    NiftyJmeDisplay niftyDisplay;
    
    AppStateManager stateManager;
    
    public PausedAppState(NiftyJmeDisplay niftyDisplay){
        this.niftyDisplay = niftyDisplay;
    }
    
    @Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        this.app = (SimpleApplication)app;
        this.stateManager = stateManager;
        this.stateManager.getState(GameRunningAppState.class).pause(true);
        pause();
    }
    
    @Override
    public void update(float tpf) {
        //TODO: implement behavior during runtime
    }
    
    @Override
    public void cleanup() {
        super.cleanup();
        stateManager.getState(GameRunningAppState.class).pause(false);
        unpause();
    }
    
    
    private void pause(){
        PauseScreenControl pauseScreenControl = new PauseScreenControl(app);
        niftyDisplay.getNifty().registerScreenController(pauseScreenControl);
        stateManager.attach(pauseScreenControl);
        niftyDisplay.getNifty().gotoScreen("pause");
    }
    private void unpause(){
        PauseScreenControl pauseScreenControl = app.getStateManager().getState(PauseScreenControl.class);
        niftyDisplay.getNifty().unregisterScreenController(pauseScreenControl);
        stateManager.detach(pauseScreenControl);
        niftyDisplay.getNifty().gotoScreen("inGame");
    }
}

Here is the PauseScreenControl.java


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package HdI.ScreenControls;

import HdI.AppStates.GameRunningAppState;
import HdI.AppStates.PausedAppState;
import HdI.Interfaces.IGUIControlers;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

/**
 *
 * @author Paulo
 */
public class PauseScreenControl extends AbstractAppState implements ScreenController{
    
    SimpleApplication app;
    
    AppStateManager stateManager;
    
    PausedAppState pausedAppState;
    
    public PauseScreenControl(SimpleApplication app){
        this.app = (SimpleApplication) app;
    }
    
    @Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        //TODO: initialize your AppState, e.g. attach spatials to rootNode
        //this is called on the OpenGL thread after the AppState has been attached
        this.app = (SimpleApplication) app;
        this.stateManager = stateManager;
        System.out.println("1\n--\n--\n--\n--\n--\n--\n--\n--");
        System.out.println(stateManager.getState(PausedAppState.class).toString());
        System.out.println("2\n--\n--\n--\n--\n--\n--\n--\n--");
        
//        app.stop();
    }
    
    @Override
    public void update(float tpf) {
        //TODO: implement behavior during runtime
    }
    
    @Override
    public void cleanup() {
        super.cleanup();
        //TODO: clean up what you initialized in the initialize method,
        //e.g. remove all spatials from rootNode
        //this is called on the OpenGL thread after the AppState has been detached
        stateManager.getState(GameRunningAppState.class).unPause();
    }
    
    public void unPause(){
        app.stop();
        app.getStateManager().getState(GameRunningAppState.class).unPause();
    }

    public void bind(Nifty nifty, Screen screen) {
        
    }

    public void onStartScreen() {
        
    }

    public void onEndScreen() {
        
    }
}

Here is the Pause_Screen.XML

<?xml version=“1.0” encoding=“UTF-8”?>
<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<!-- pause screen -->
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<useStyles filename=“nifty-default-styles.xml” />
<useControls filename=“nifty-default-controls.xml” />

&lt;screen id="pause" controller="HdI.ScreenControls.PauseScreenControl"&gt;
    &lt;layer id="layer" childLayout="center"&gt;
        &lt;panel id="panel" height="25%" width="35%" align="center" valign="center" backgroundColor="#f60f" childLayout="center" visibleToMouse="true"&gt;
            &lt;interact onRelease="unPause()"/&gt;
            &lt;effect&gt;
                &lt;onStartScreen name="move" mode="in" direction="top" length="300" startDelay="0" inherit="true"/&gt;
                &lt;onEndScreen name="move" mode="out" direction="bottom" length="300" startDelay="0" inherit="true"/&gt;
                &lt;onHover name="pulsate" scaleFactor="0.008" startColor="#f600" endColor="#ffff" post="true"/&gt;
            &lt;/effect&gt;
            &lt;text id="text" font="Interface/Fonts/font.fnt" text="Pause" align="center" valign="center" /&gt;
        &lt;/panel&gt;
    &lt;/layer&gt;
&lt;/screen&gt;

</nifty>

I did not put the .xml int the code tag because it was weird…


<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
    <!-- +++++++++++++++++++++++++++++++++++++++ -->
    <!-- pause screen -->
    <!-- +++++++++++++++++++++++++++++++++++++++ -->    
    <useStyles filename="nifty-default-styles.xml" />
    <useControls filename="nifty-default-controls.xml" />
    
    <screen id="pause" controller="HdI.ScreenControls.PauseScreenControl">
        <layer id="layer" childLayout="center">
            <panel id="panel" height="25%" width="35%" align="center" valign="center" backgroundColor="#f60f" childLayout="center" visibleToMouse="true">
                <interact onRelease="unPause()"/>
                <effect>
                    <onStartScreen name="move" mode="in" direction="top" length="300" startDelay="0" inherit="true"/>
                    <onEndScreen name="move" mode="out" direction="bottom" length="300" startDelay="0" inherit="true"/>
                    <onHover name="pulsate" scaleFactor="0.008" startColor="#f600" endColor="#ffff" post="true"/>
                </effect>
                <text id="text" font="Interface/Fonts/font.fnt" text="Pause" align="center" valign="center" />
            </panel>
        </layer>
    </screen>
</nifty>

Thanks.

YAY!
Solved it
For some reason, the xml need to be read after the controller is registered at nifty.
And doing it, my problem is solved. \o/
If someone wants to see my code, just ask for it