Loading new Nifty Styles

I’m using Jme3 with Eclipse, and am trying to load in my own style for the Nifty 1.3.1 controls.

I’m basically just trying to duplicate the nifty default style, and alter the images and .xml styles within. ( which I believe is recommended somewhere on the wiki )

The problem is that I cannot seem to load any new styles - just using the default has been the only thing that works ( nifty.loadStyleFile(“nifty-default-styles.xml”) )

For example how would I load another style in??

A direct file reference doesn’t seem to work:


It does seem to work by putting the style folder in the project assets folder


But this actually lends to some really strange behavior. It sees the ‘nifty-default-styles.xml’, but still reverts to using the default styles (meaning it’s not actually pointing to the files in the asset folder)

am I missing something?

What tactics do people use to load in custom nifty styles using eclipse?

Use not: “assets/Interface/src/main…”

Use : “Interface/src/main…”

thanks for the response kern, but that doesn’t work either.

when using eclipse I add the ‘assets/’ to be able too see the assets (its working for all my other images).

Like mentioned it actually loads up the default style from that path to the assets folder when I copy it there, but the styles used are not from that folder in assets. it seems to revert to using the nifty defaults in jar…

Is anyone using their own styles with Eclipse? where do you put the folder? I still just can’t seem to have it loaded correctly from anywhere. I’m in the last stages of an awesome jme3 project I’ll be able to share, just still trying to get past some hurdles.

any help highly appreciated

I don’t know, i don’t use eclipse.

But you can also use StyleBuilder once you have a nifty instance.

Ok,i even use netbeans soory…

@cghislai, StyleBuilder? Sounds interesting, what is this?

new StyleBuilder() {



set(“backgroundColor”, “#888888ff”);



Ohh, i know… thougt it was plugin.

Well thanks guys, I still haven’t solved the problem of loading a style file into Nifty using Eclipse.

But as cghislai suggested, StyleBuilder() works, so I’m doing everything that way - defining styles in Static classes overriding the style id’s that are used in the default style files.

I’ll still post back here if I ever find a solution of loading new style files…

You can also check the order in which you load the styles, i.e you need to load your custom style after nifty default one if you want to override it IIRC

Your files just have to be on the classpath, just add whatever jar or folder they are in to the classpath.