[SOLVED] Having problems with Nifty code completion

Hi monkeys! Today I finally started learning how to use Nifty GUI, and I’m following the JME wiki and the Nifty manual. One thing I must do is to implement a schemaLocation, or something like that, so the IDE is able to provide me code completion. This is my nifty tag:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
</nifty>

However, it seems it’s not working. The only thing I get is if I type <layer>, the IDE completes with a </layer> tag.

I tried to go to the link of the Nifty schema (http://nifty-gui.sourceforge.net/nifty-1.3.xsd), and It gave me error code 404. Is it missing or I can’t access it from the browser?

Thanks,
Ev1lbl0w

that link no longer exists.

I hosted that file for my own needs but you can do it too with github.io, that xsd file is inside the nifty Jar file for you to copy.

Thanks. I looked online and most people say it’s better to use the .xsd file bundled within the nifty jar. I have that file now, and I have put it in my libs folder in my project. So, how do I access that file now? I tried writing libs/nifty-1.3.xsd but it doesn’t work. I’m also new to XML, so I’m still learning xD

In my case I just host it in github.io(need a github account for that), makes things easier for all my projects.

Thanks for the help! I found that same .xsd file hosted on Github. So, when I use that link in the IDE, it actually downloads the xsd after I accept 2 warnings of not-signed certificates. But I still don’t get any code completion or any result when I do Ctrl + Space.

This is my nifty header:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="https://raw.githubusercontent.com/nifty-gui/nifty-gui/1.3/nifty-core/src/main/resources/nifty-1.3.xsd" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://raw.githubusercontent.com/nifty-gui/nifty-gui/1.3/nifty-core/src/main/resources/nifty-1.3.xsd https://raw.githubusercontent.com/nifty-gui/nifty-gui/1.3/nifty-core/src/main/resources/nifty-1.3.xsd">
</nifty>

Am I doing anything wrong or should I activate an option in the IDE’s config?

There isn’t really all information in those xsd files. The default nifty file template in the SDK should have the current xsd in it by default though?

When I create a new GUI in the SDK, it points to the old sourceforge link. I still have jME 3.0

OK so I’m pretty sure Nifty is broken as f*** in the jME SDK 3.0. I tried to add a button, but it doesn’t even recognize it! I’m using the exact same example from the Nifty Wiki and it says is missing. Also, the preview tab of the xml editor only renders once. So, if I add a new element to the file, I need to reopen it so it renders the edit.

So, I will now update my SDK to jME 3.1 and I hope it will fix all the bugs I have.

Yes nifty is really buggy in jME3. I have given up on it a long time ago.

1 Like

Well the “editor” is a well-meant addon, nobody said its perfect. Theres the source code however so you’re free to extend/fix it as you see fit.

1 Like

Ok, so now I have jME 3.1 and the code completion actually works! The only thing I don’t understand is why I don’t get code completion when I do <panel> tag. The layer and screen tags work well, but panels don’t.

Also, whenever I try to use the <text> tag, the IDE deletes it as soon as it can!! Why does this happens? Has it been deprecated or something?

Seriously, I need help with this. The IDE just deletes the code without any warning. It’s pissing me off.

I’m pretty sure the text tag is long since depreciated.

1 Like

So, if it is deprecated, what should I use now instead? TextField?

Yes, a textfield control is the recommended way now.

1 Like

Ok thanks! Guess the problem is solved for now!