Resizable NiftyJmeDisplay through a canvas?

How can someone resize the NiftyJmeDisplay? For example, the canvas first has a dimension of 800 by 600, the user resizes the window, and then the canvas gets redrawn to the new dimension of 1440 by 900.

It’s easily done by reloading the entire XML configuration like this:


display.reshape(null, 1440, 900); //done dynamically in the real code

Nifty nifty = display.getNifty();

nifty.fromXml(“Interface/lobby.xml”, “login”, controller);


But reshaping the display after loading from XML doesn’t resize the screen. If you reload the screen from XML, you loose all the information the user has contributed (so that’s not an optimal solution). That works though, so if there was a way to keep user input, but still having to reload the screen, I’d be happy as well.

I’ll post a screenshot as example:

If you guessed the login should be centered, you guessed correctly.

I created a sample project that demonstrates this issue:

Thanks in advance!

Looks like this is something that should be implemented on the nifty gui side? How about a Nifty.reshape/resize method?

1 Like

In the meantime, I’ve created a simple project that demonstrates the functionality:

There already is a feature request in the feature request tracker here →

… and I’m currently working on this because it’s one of the final things to be done before 1.3. and to be honest it gives me headaches :smiley:

… but yeah, I’m working on it!


Thanks a lot. :slight_smile: If you need any help, just let me know.

Ok, this is in SVN now and there is a new blog post online with a quick video demonstrating it.

Not tested with JME3 yet but it should work there as well.

Please complain in here, if it does not :wink:


Nice work void!