[SOLVED] Import NiftyGUI doesn't work (for sure a newbie-question)

Hello!

I don’t know if I’m asking a really stupid question right now, but I can’t seem to find the solution:

When working through this tutorial, they start with adding the following imports:

import com.jme3.app.SimpleApplication;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.builder.ScreenBuilder;
import de.lessvoid.nifty.builder.LayerBuilder;
import de.lessvoid.nifty.builder.PanelBuilder;
import de.lessvoid.nifty.controls.button.builder.ButtonBuilder;
import de.lessvoid.nifty.screen.DefaultScreenController;

However, all of these imports (apart from SimpleApplication) ‘do not exist’. In the tutorial, they also give a link to the source code, but I don’t know if I need to use this (and if I do, how to download it).

Am I missing an add-on or something else? Again, sorry for the seemingly stupid question (if this was a recurring problem I’d find a thread about it somewhere)

2 Likes

At me it is imported and works.

Full import:

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.asset.AssetManager;
import com.jme3.asset.plugins.FileLocator;
import com.jme3.audio.AudioRenderer;
import com.jme3.input.FlyByCamera;
import com.jme3.input.InputManager;
import com.jme3.niftygui.NiftyJmeDisplay;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

Perhaps you need to do this:

	@Override
	public void simpleInitApp() {

		NiftyScreen niftyScreen = new NiftyScreen();
		stateManager.attach(niftyScreen);
		inputManager.deleteMapping(SimpleApplication.INPUT_MAPPING_EXIT);
		
	}
1 Like

Did you add the nifty library as a reference?

2 Likes

My god, I even found it in the global libary but I assumed that would already be in the file since it was in the global libary.
I feel really stupid now.
Thank you very much! And thanks @AdiDOS for also helping :slight_smile:

3 Likes