[SOLVED] Having trouble with controller (Nifty)

I’ve been messing with some tutorial code. My menu appears with the buttons, however when I go to click a button nothing happens. I made the method it was suppose to run print out something to the console but it doesn’t . So is it not finding the controller or what?



screen.xml

[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”>

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<!-- start screen -->

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<useControls filename=“nifty-default-controls.xml” />

<useStyles filename=“nifty-default-styles.xml” />



<screen id=“start” controller=“gamerScreen.TitleScreen”>

<layer id=“background” childLayout=“center”>



<image filename=“Interface/backgroundTitle.png” imageMode=“normal” ></image>



</layer>



<layer id=“Foreground” backgroundColor="#0000" childLayout=“vertical”>

<panel id=“panel_top” height=“24%” width=“100%” align=“center” childLayout=“center”

backgroundColor="#f008">

<text text=“My Cool Game” font=“Interface/Fonts/Default.fnt” width=“100%” height=“100%” />

</panel>



<panel id=“panel_top2” height=“14%” width=“100%” align=“center” childLayout=“center”

backgroundColor="#00f8">

<control name=“button” label=“Switch to Hud” id=“SwitchButton” align=“center” valign=“center”

visibleToMouse=“true” >

<interact onClick=“switchScreens(hud)”/>

</control>

</panel>



<panel id=“panel_middle” height=“19%” width=“100%” align=“center” childLayout=“center”

backgroundColor="#f0f8">

</panel>



<panel id=“panel_middle2” height=“19%” width=“100%” align=“center” childLayout=“center”

backgroundColor="#f008">

</panel>



<panel id=“panel_bottom” height=“19%” width=“100%” align=“center” childLayout=“center”

backgroundColor="#44f8">

<control name=“button” label=“Exit” id=“ExitButton” align=“center” valign=“center”

visibleToMouse=“true” >

<interact onClick=“gameExit()” />

</control>

</panel>



<panel id=“panel_verybottom” height=“15%” width=“25%” align=“center” childLayout=“center”

backgroundColor="#f008">



</panel>





</layer>

</screen>



<screen id=“hud” controller=“gamerScreen.TitleScreen”>



<layer id=“background” backgroundColor="#000f" childLayout=“center”>

<panel id=“hd_panel” height=“100%” width=“100%” align=“center” childLayout=“center”

backgroundColor="#f008">

</panel>

</layer>

<layer id=“foreground” backgroundColor="#0000" childLayout=“horizontal”>

<control name=“label” color="#000" text=“123555” width=“100%” height=“100%” />

</layer>



</screen>

</nifty>

[/xml]



TitleScreen.java



[java]

package gamerScreen;





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.builder.ScreenBuilder;

import de.lessvoid.nifty.screen.Screen;

import de.lessvoid.nifty.screen.ScreenController;



public class TitleScreen extends AbstractAppState implements ScreenController {



private Nifty nifty;

private Screen screen;

private SimpleApplication app;









public TitleScreen(String data) {

/** You custom constructor, can accept arguments /

}



/
* Nifty GUI ScreenControl methods /



public void bind(Nifty nifty, Screen screen) {

this.nifty = nifty;

this.screen = screen;

}



public void onStartScreen() { }



public void onEndScreen() { }



public void swithScreens(String screen){

System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@");

nifty.gotoScreen(screen);

}



public void gameExit(){

app.stop();

}



/
* jME3 AppState methods /



@Override

public void initialize(AppStateManager stateManager, Application app) {

super.initialize(stateManager, app);

this.app=(SimpleApplication)app;

}





@Override

public void update(float tpf) {

/
* jME update loop! */

}



}[/java]

Sorry for the double post, but I’ve read up on some other topics in the forum and I couldn’t seem to find one that solved my issue though some came close. Unless I’m mistaken my code should work fine but I’m missing something some where. In the console it registers that I clicked the mouse, but it doesn’t do anything to tell me I clicked the button and it doesn’t call the method the button should execute.

You have a typo in your method name its trying to call back.

@zarch said:
You have a typo in your method name its trying to call back.


That's a face-to-keyboard moment right there. Thanks. xD