Help needed with splash screen and calling a GUI thereafter

Currently I have a splash screen that works like this.

[java]package com.thisisntimportant

import com.jme3.niftygui.NiftyJmeDisplay;

import de.lessvoid.nifty.EndNotify;

import de.lessvoid.nifty.Nifty;

import de.lessvoid.nifty.screen.NullScreen;

import de.lessvoid.nifty.screen.Screen;

public class SplashScreen {

public void splash(final SplashScreenCallback callback, NiftyJmeDisplay niftyDisplay) {

Nifty nifty = niftyDisplay.getNifty();

nifty.fromXml(“splash_screen.xml”, “splash”);

Screen currentScreen = nifty.getCurrentScreen();

System.out.println("current screen is: "+currentScreen.getScreenId());

if(!(currentScreen instanceof NullScreen)) {

currentScreen.startScreen(new SplashEndHandler(nifty, callback));

System.out.println(“current screen is: “+currentScreen.getScreenId());



private static class SplashEndHandler implements EndNotify {

private Nifty nifty;

private SplashScreenCallback callback;

public SplashEndHandler(Nifty nifty, SplashScreenCallback callback) {

this.nifty = nifty;

this.callback = callback;



public void perform() {






It’s instantiated like this

[java]niftyDisplay = niftyDisplayProvider.buildNiftyDisplay(assetManager, inputManager, audioRenderer, guiViewPort);



splashScreen.splash(this, niftyDisplay);[/java]

Later on in my code, I attempt to call up another GUI, just for a simple test.

[java]Nifty nifty = niftyDisplay.getNifty();

Screen screen = new ScreenBuilder(“test”){{

layer(new LayerBuilder(“baseLayer”){{


panel(new PanelBuilder(){{







This screen however never appears. Is nifty.exit() that is called when the splash screen is over the culprit? If so, what can I use to clear the splash screen out of the way and have my game progress?

If I comment out the entire splash screen itself, the test gui above works just fine. Any help is appreciated…

You don’t want nifty.exit() there. To switch screens simply tell nifty to goto that screen, the old one will be removed then.


Thanks Sploreg. That did it.