[Solved] GUI doesn’t show up in built game

hey monkeys,

i went through the Nifty tutorials and everything worked fine. As long as i run my game in the IDE (F6) thw gui shows up. When I klick “Clean And Build Main Project” and run the MyGame.jar file only the blue cube shows up without my gui.

[java]package mygame;

import com.jme3.app.SimpleApplication;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.niftygui.NiftyJmeDisplay;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.system.AppSettings;

import de.lessvoid.nifty.Nifty;

public class Main extends SimpleApplication {

private MyStartScreen startScreen;

public static void main(String[] args) {

AppSettings settings = new AppSettings(true);

settings.setResolution(640, 480);

Main app = new Main();

app.setShowSettings(false); // splashscreen





public void simpleInitApp() {



Box b = new Box(Vector3f.ZERO, 1, 1, 1);

Geometry geom = new Geometry(“Box”, b);

Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

mat.setColor(“Color”, ColorRGBA.Blue);



startScreen = new MyStartScreen();


NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(

assetManager, inputManager, audioRenderer, guiViewPort);

/** Create a new NiftyGUI object /

Nifty nifty = niftyDisplay.getNifty();

* Read your XML and initialize your custom ScreenController /

// nifty.fromXml(“Interface/helloworld.xml”, “start”, new MySettingsScreen(data));

// attach the Nifty display to the gui view port as a processor


nifty.fromXml(“Interface/newNiftyGui.xml”, “start”, startScreen);

// disable the fly cam




public void simpleUpdate(float tpf) {

//TODO: add update code



public void simpleRender(RenderManager rm) {

//TODO: add render code




[java]package mygame;

import com.jme3.app.Application;

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;

public class MyStartScreen extends AbstractAppState implements ScreenController {

private Nifty nifty;

private Screen screen;

private Application app;

MyStartScreen() {


* custom methods /

public void startGame(String nextScreen) {

nifty.gotoScreen(nextScreen); // switch to another screen

// start the game and do some more stuff…


public void quitGame() {



public MyStartScreen(String data) {

* Your 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() { }

* jME3 AppState methods */


public void initialize(AppStateManager stateManager, Application app) {




public void update(float tpf) {



[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=“mygame.MyStartScreen”>

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

<image filename=“Interface/bubblehead.jpg”></image>


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

<panel id=“panel_top” height=“25%” width=“75%” align=“center” childLayout=“center”>

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


<panel id=“panel_mid” height=“50%” width=“75%” align=“center” childLayout=“center”>

<text text=“Here goes some text describing the game and the rules and stuff. Incidentally,

the text is quite long and needs to wrap at the end of lines. …”

font=“Interface/Fonts/Default.fnt” width=“100%” height=“100%” wrap=“true” />


<panel id=“panel_bottom” height=“25%” width=“75%” align=“center” childLayout=“horizontal”>

<panel id=“panel_bottom_left” height=“50%” width=“50%” valign=“center” childLayout=“center”>

<control name=“button” label=“Start” id=“StartButton” align=“center” valign=“center” visibleToMouse=“true”>

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



<panel id=“panel_bottom_right” height=“50%” width=“50%” valign=“center” childLayout=“center”>

<control name=“button” label=“Quit” id=“QuitButton” align=“center” valign=“center” visibleToMouse=“true” >

<interact onClick=“quitGame()”/>






<screen id=“hud” controller=“mygame.MyStartScreen”>

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

<image filename=“Interface/HUD.png” width=“100%” height=“100%”/>


<layer id=“foreground” childLayout=“horizontal”>

<panel id=“panel_left” width=“80%” height=“100%” childLayout=“vertical” >

<!-- spacer -->


<panel id=“panel_right” width=“20%” height=“100%” childLayout=“vertical”>

<panel id=“panel_top_right” height=“100%” width=“15%” childLayout=“center”>

<control name=“label” text=“123” width=“100%” height=“100%” />


<panel id=“panel_top_right2” width=“100%” height=“15%” childLayout=“center”>


<panel id=“panel_bot_right” width=“100%” height=“70%” valign=“center”>






finally stumbled upon this link:


IDE restart fixed it. strange world… :?

Taiten - For the nifty tutorial that you posted. Did you have issues with the images the tutorial wants you to use? I see that you used “Interface/HUD.png” is that the same hud picture used in the tutorial? I am having issues figuring out where the images for the tutorial are actually located so that I can point my class path or download.