Nifty Window not accepting input after clicking into the scene


after fixing the bone.getAttachmentsNode() thing in my editor I noticed that another error occurs: When I click into the scene I can’t select anything in my nifty window anymore. How can I change that? I’ll post a (long) showCase:

[java]package editor;

import de.lessvoid.nifty.Nifty;

import de.lessvoid.nifty.NiftyEventSubscriber;

import de.lessvoid.nifty.builder.LayerBuilder;

import de.lessvoid.nifty.builder.PanelBuilder;

import de.lessvoid.nifty.builder.ScreenBuilder;

import de.lessvoid.nifty.controls.ButtonClickedEvent;

import de.lessvoid.nifty.controls.CheckBoxStateChangedEvent;

import de.lessvoid.nifty.controls.button.builder.ButtonBuilder;

import de.lessvoid.nifty.controls.checkbox.builder.CheckboxBuilder;

import de.lessvoid.nifty.controls.label.builder.LabelBuilder;

import de.lessvoid.nifty.controls.window.builder.WindowBuilder;

import de.lessvoid.nifty.screen.Screen;

import de.lessvoid.nifty.screen.ScreenController;

public class EditorScreenBuilder2 extends ScreenBuilder {

private ShowCase sc;

private BigController bc;

public EditorScreenBuilder2(ShowCase me) {

super(“start”); = me;

bc = new BigController(sc);



private void buildGUI() {


layer(new LayerBuilder(“baseLayer”) {



control(new WindowBuilder(“myWindow”, “Title of Window”) {



closeable(false); // you can close this window -.-

width(“200px”); // windows will need a size




panel(new PanelBuilder() {



//Mesh CheckBox

panel(new PanelBuilder() {



control(new LabelBuilder() {


text(“Show Meshes:”);




control(new CheckboxBuilder(“showMeshes”) {









panel(new PanelBuilder() {






panel(new PanelBuilder() {



control(new ButtonBuilder(“view”, “Edit”));




}); //End WindowPanel


}); //End WIndow




public static class BigController implements ScreenController {

private ShowCase sc;

public BigController(ShowCase sc) { = sc;



public void bind(Nifty arg0, Screen arg1) {



public void onEndScreen() {



public void onStartScreen() {


@NiftyEventSubscriber(id = “showMeshes”)

public void meshesClicked(String id, CheckBoxStateChangedEvent event) {

System.out.println(“Nifty Input”);


@NiftyEventSubscriber(id = “view”)

public void viewChange(String id, ButtonClickedEvent event) {

System.out.println(“Nifty Input”);





[java]import java.util.logging.ConsoleHandler;

import java.util.logging.Handler;

import java.util.logging.Level;

import java.util.logging.Logger;


import com.jme3.input.KeyInput;

import com.jme3.input.MouseInput;

import com.jme3.input.controls.ActionListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.input.controls.MouseButtonTrigger;

import com.jme3.niftygui.NiftyJmeDisplay;

import com.jme3.system.AppSettings;

import de.lessvoid.nifty.Nifty;

public class ShowCase extends SimpleApplication implements ActionListener {

private Nifty nifty;





public void simpleInitApp() {



//cam.setFrustumNear(cam.getFrustumNear() / 4);

NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);

nifty = niftyDisplay.getNifty();


Logger root = Logger.getLogger("");

Handler[] handlers = root.getHandlers();

for(int i = 0; i < handlers.length; i++) {

if(handlers instanceof ConsoleHandler) {

((ConsoleHandler) handlers).setLevel(Level.WARNING);





} //End simpleInitApp()

private void initInput() {

String[] mappings = new String[] {















// Remove last mapping for the flyByCam


// Change the mappings we don’t want

inputManager.addMapping(“FLYCAM_RotateDrag”, new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));

inputManager.addMapping(“FLYCAM_Rise”, new KeyTrigger(KeyInput.KEY_Q));

inputManager.addMapping(“FLYCAM_Lower”, new KeyTrigger(KeyInput.KEY_E));

// Recreate the mapping for the flyByCam

inputManager.addListener(flyCam, mappings);

inputManager.addMapping(“Select”, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

inputManager.addMapping(“Delete”, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));

inputManager.addMapping(“Edit”, new KeyTrigger(KeyInput.KEY_R));

inputManager.addMapping(“Toggle_Highlight”, new KeyTrigger(KeyInput.KEY_T));

inputManager.addListener(this, “Select”, “Edit”, “Toggle_Highlight”, “Delete”);





private void initGUI() {



nifty.addScreen(“start”, new EditorScreenBuilder2(this).build(nifty));


}//End initGUI();




public void onAction(String name, boolean keyPressed, float tpf) {

if(name.equals(“Select”) && !keyPressed) {


} else if(name.equals(“Delete”) && !keyPressed) {


} else if(name.equals(“Edit”) && !keyPressed) {


} else if(name.equals(“Toggle_Highlight”) && !keyPressed) {



} //End onAction()




public static void main(String[] moep) {

SimpleApplication app = new ShowCase();

AppSettings settings = new AppSettings(true);


settings.setResolution(1024, 768);




} //End main()



Notify if any exception was threw.

There is no exception thrown. I removed the removal of nifty’s logging.

Nifty writes logs into the console with no care if the mouse is over the window or over the scene. But no exception.

I have exactly the same problem.

Before I click the scene nifty works fine.

But after I interact with my scene I cannot use the gui anymore.

No exceptions are thrown.

Is this issue with the nightly build?

Mine is from 25.02 (the previous one had other issues^^)

Ok, i committed some changes in jmeInputSystem on march 3 so it’s not what’s causing your issue.

Did you have this issue before?

The build from 20.02 worked fine. The 25th then broke the Bone.getAttachmentsNode() so I noticed that issue that late.

Is it safe to switch to today’s nightly? Then I would test that out.

@enum said:
Is it safe to switch to today's nightly?

Its never safe to switch to nightly. Thats why there is a stable branch..

It’s a bit weird… I created a new project and used JME from 20.02 and 07.02 and both showed the same error. But that’s impossible 'cause I started with the editor at 09.02 and it worked. I could select a geometry in the scene and after that press the edit button successfully. I will try again on my laptop where I did this (now I have a new desktop pc)

Yeah, I plan to switch to the next stable.

With safe I meant: relativly save so that the basic stuff works :wink:

@enum said:
With safe I meant: relativly save so that the basic stuff works ;)

Yeah, thats the main flaw when thinking about using nightly. Its not just about what works and what not. API might be there that disappears again, file formats might not have gotten the version number updates etc. etc.

Thats a good hint but at the moment I’m interested in helping finding that bug that seems to appear to more people than just me^^

On my laptop it didn’t work either (not even with the older version)… I can’t understand what happens there… I can click into the window and drag, that has the same effect as if I would drag with the mouse cursor inside the scene…

I will download the latest nightly and test with it.

Edit: no difference with latest nightly :frowning:

I can second (or third? fourth?) this problem.

interactOnClick works fine until I click away from nifty (ie on the scene). At this point, nifty does not capture mouse clicks and they just go through to the scene beneath.

Any updates?

Using October 2011 stable engine on OSX.

did anybody find any solution for this bug? please, don’t forget to fix it!! many persons have the same problem!!! thank you

OK, I’ll need to dig it up again to ask if anyone still having this problem.

Unfortunately I do. I use the nighty from the 24’th of june.

From what I see the class MouseInputEventProcessor stores the value ‘true’ in this field


private boolean lastButtonDown0;


fter I click the scene.

The value is never changes and thus the method ‘canProcess’ always returns false.

1 Like

Yep - I’m still having it unfortunately.

I gave up in the end and build my app with swing components and a JME Swing canvas.

Maybe this problem only occurs when you use java api to build gui instead of xml files?

Does anyone has the same error while using nifty xml ???

the solution that I found is:

adding this code in the simpleInitApp:

inputManager.addMapping(“FLYCAM_RotateDrag”, new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));

inputManager.addMapping(“FLYCAM_RotateDrag”, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));

inputManager.deleteTrigger(“FLYCAM_RotateDrag”, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

and this one in simpleUpdate() method:

inputManager.deleteTrigger(“FLYCAM_RotateDrag”, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

now I dont have more problem. I hope it continues like this.


1 Like

Correct me if I’m wrong but fiddling with input triggers every update sounds a bit ugly. Nonetheless its the only solution so far (havent tested it myself)