1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Getting Started

From nifty-gui

Jump to: navigation, search



This explains what you need to download and get you up and running with Nifty GUI.

What is Nifty and how does it work?

With Nifty you're using xml-files to define your graphical user interface. This means you use xml to position elements on the screen. You can then add different effects to the elements. Effects can change the appearance of elements. You can move elements in position for instance or alpha blend them. There are also a lot of different hover-effects available that you can use to make interacting with the elements interessting.

To add logic to your user interface you write simple java classes. More on that in the Hello World Example.

Nifty was designed to be as easy as possible to be included into existing applications. This basically means, that you need to initialize whatever rendering system you want to use [f.i. http://www.lwjgl.org/ lwjgl] the way you would normally do and just call nifty when you need it. Nifty uses the current Displaymode and adapts to it.

All you need is a Nifty RenderDevice Implementation for your rendering backend. You can find an overview over all available RenderDevices here: Nifty RenderDevice, SoundDevice and InputSystem Adapters.

Ok, What do I need to download?

Starting with Nifty 1.2 the Nifty core is available independent of any specific rendering systems like lwjgl or slick2d. This means you will need the nifty.jar and an appropriate nifty-rendering.jar to connect Nifty with lwjg, slick, jme2 or jme3. Because of this there will be no "complete" version of nifty available anymore, that would contain all dependencies in one big jar file. That's simply because we don't know what rendering system you want to use Nifty with :)

So you need to download:

  • The nifty.jar file (current version is nifty-1.2.jar). This is the core nifty module and contains the nifty "engine". You'll need additional dependencies in your classpath to successful get it running.
  • The nifty-<system>-renderer.jar file. This connects Nifty to the rendering-, input- or sound-system of your choice. If you would like to use nifty with lwjgl you need to download nifty-lwjgl-renderer.jar too.
  • All the libs your renderer needs. In case of nifty-lwjgl-renderer.jar you'll need to download lwjgl.jar on your own. If you're using maven, this is done for you.
  • Nifty dependencies. (see Dependency below)

You can find both version at the sourceforge download page.

Nifty Dependencies

For parsing XML-Files it also uses XPP3. You need to download xpp3_min-1.1.4c.jar (or later?) for nifty to work. This is version that surely works with nifty, there is a small chance that other versions may not.

Using Nifty with Maven

When your project is using Maven you can use the following dependencies:

Nifty Core:


Nifty Default Controls


Nifty Style Black


Nifty Style Grey


Nifty Lwjgl Renderer


Nifty OpenAL/Lwjgl Soundsystem


Nifty Pauls Soundsystem


Nifty Lwjgl/Slick Renderer


Using Nifty Maven Repository

Usually when you're using Maven and you need libaries that are not available in the Maven Central Repository you need to download and install the artifacts in your local repository to make it working. Well, but luckily you can use other remote repositories too! Like the Nifty Maven Repository hosted by sf.net as part of the Nifty Project. This means you can simply add this to your pom.xml and all of Niftys Artifacts are available to your project without the need to download them manually:


Build Nifty 1.2 without Maven from the downloadable jars

The following steps explain downloading Nifty 1.2 Examples and build it with Eclipse:

I'm using Eclipse Helios but any other Version should do fine.

I've created a new Java project from the new project wizard.

I've downloaded the following jars from the Nifty sf.net project page:

  • nifty-examples-1.2-sources.jar
  • nifty-1.2.jar
  • nifty-default-controls-1.2.jar
  • nifty-lwjgl-renderer-1.0.jar
  • nifty-style-black-1.2.jar
  • nifty-style-grey-1.0.jar
  • nifty-openal-soundsystem-1.0.jar

I've extracted nifty-examples-1.2-sources.jar so that I have it's uncompressed content available.

I've copied the content of nifty-examples-1.2-sources to the src folder of the eclipse project. In fact I've just drag'n'droped everything to src.

I've created a libs folder in the project in eclipse and copied all the jars I've downloaded into this folder (besides the examples.jar of course).

The examples use lwjgl for rendering. So I've downloaded lwjgl 2.4.2 and copied "lwjgl.jar" and "lwjgl_util.jar" from the lwjgl distribution to the lib folder.

Nifty is using the XPP3 parser for XML parsing. So I've downloaded xpp3-1.1.4c.jar from [1] and added this as well to the libs folder (this specific version is simply the version nifty is using and I don't know what happens when one would use a different one ;-)

Now I've added all the jars to the java build path inside eclipse.

The project compiles now fine. I can run the AllExamplesMain project and only need to add -Djava.library.path=<path-to-lwjgl-natives-for-my-os> to get it running.

Here is a screenshot of the project:


Personal tools