(jME3) Problems with NiftyGUI ScreenController


I have a problem with the NiftyGUI ScreenController.

My program doesn’t find the class, that’s defined with the controller.

This is in my gui XML:

This is how my class is defined:

package PlatformGame;

public class MenuState extends AbstractAppState {

private class AppScreenController implements ScreenController {

public void bind(Nifty nifty, Screen screen) {

throw new UnsupportedOperationException(“Not supported yet.”);


public void onStartScreen() {

throw new UnsupportedOperationException(“Not supported yet.”);


public void onEndScreen() {

throw new UnsupportedOperationException(“Not supported yet.”);




Does anybody know what the problem is ?

Thanks in advance.

It cannot find it probably because you have your AppScreenController declared as private class, contained in some other class. You should make this AppScreenController public class and put it in a separate .java file.

It works now.

Thanks for the help.

Another question about NiftyGUI.

How can I implement the onClick methods in my ScreenController ?

I now have done this:



public void start() {

throw new UnsupportedOperationException(“Not supported yet.”);


Error message:

19-sep-2010 21:41:51 de.lessvoid.nifty.NiftyMethodInvoker performInvoke

WARNING: invoke for method [start()] failed

Well, if your method just throws an exception its sure to fail, hm? If you remove that and it still doesnt work, check if you reference the correct class as controller in the nifty xml file.

The controller class was wrong. There is still the error message that the method cannot invoked, but the methods is actually executed.

Thanks for the help.

I still have one question. How can I get access to my application ? Should I create a static method in my application class to get the application object ?

You could do that, yes.

It looks like it’s working with the static method.

Maybe it’s a good idea to add this to the sample code.

This should be really the last question about the ScreenController…

I’m a little bit lost with the java generics. I now have this code to get the GameState:

GameState gameState = CarGame.getApp().getStateManager().getState(GameStategameState);

Is this the way how I should get the GameState ?