Nifty & Mouse Cursor strange behavior [solved]

I’ve recently been trying to make a generic starting point that I can use for any game I want to try to make. It uses the Nifty GUI methods to create a generic start screen, options screen, key binding, and a pause screen while the game runs. After a few hair pulling days I eventually taught myself how to make everything work. Whether it’s efficient or not is besides the point. As my friend’s teacher once said “Any code that works is good code.” And it works… almost… sorta. When I open the pause menu I have to click twice before a button works. When I click the return to game button then open the pause menu again, the pause menu disappears and it goes back to the game HUD with any mouse movement. I’ve narrowed it down to the point where I use:


If I don’t change the state, regardless of whether the cursor stays hidden or shown, everything works as it should. Only when it is shown for the menu then hidden again after returning to the game does everything go sideways. I get the same results with:


Exact scenario:

Click Start - game starts & switches to HUD screen

hit Esc - game pauses & pause menu opens

Click Return to Game (or anywhere for that matter) - nothing happens

Click Return to Game - game resumes and switches back to HUD screen

hit Esc - game pauses & pause menu opens

move mouse - game resumes and switches back to HUD screen

if I keep moving the mouse and spamming Esc, eventually the pause menu will stay open

I don’t know if it will help but these are the methods I’m using:


public void pause() {


paused = true;


speed = 0;


public void unPause() {


paused = false;


speed = speedDefault;




public void guiScreen(String nextScreen, String paused) {

if (Boolean.valueOf(paused)) {


} else {






first of all

Any code that works is good code

hell no

and is your cursor on the "Return to game" button when the cursor appears on your pause menu? because i had a similar problem a while ago. Where a click is generated on an initial mouse move.

when your pause menu disappears when your move mouses, do you see any nifty logs appear, with 2 zeroes at the end afterwards? like

[java]09-Oct-2012 21:43:41 de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processMouseEvent
INFO: [processMouseEvent] [341, 359, 0, 0, true] processed [true][/java]

i don't have the issue anymore, but something a bit worse, where the text has all shifted right

After cruising around the website for awhile I found out that my jme3 wasn’t up to date. I had assumed that clicking “Check for updates” and it telling me there were none was enough. After uninstalling then installing RC2, the problem disappeared and everything works as intended. Thanks for the reply and sorry for the unneeded post.