Radio button control

I’m getting this when trying to use a radiobutton control via xml:



WARNING: controlDefinition [radioButton] missing.

java.util.NoSuchElementException



Sure enough, I checked all the jar files in my classpath and nowhere can I find any references to anything like “radiobutton”. I have the following relevant jars in my classpath:



nifty-1.3-SNAPSHOT.jar

nifty-default-controls-1.3-SNAPSHOT.jar

eventbus-1.4.jar

xmlpull-xpp3-1.1.4c.jar

(and others which I don’t believe are UI related)

What’s missing?

did you [xml]<useControl filename="nifty-default-controls-filename" />[/xml] ?

Did this based on an example xml file:



[xml] <useControls filename=“nifty-default-controls.xml” />[/xml]



Hmm, when I paste the line you suggest in place of the above, display.getCurrentScreen().findElementByName() returns a null when it was working previously (all I did was paste xml from a radiobutton example). That might be the issue but I need to look into it more. Actually, even if I don’t add any additional xml, findElementByName() still fails (I think the GUI is just failing to init entirely).



Haven’t been able to find any documentation on the useControl or useStyles tags, other than some references in a few examples.

Gonna call off the request for assistance here, as I’m most likely going to switch to a Swing UI. Spent a bit too much time on this and I really need to get back to the core of my project. I’m still not sure what was going on with this radioButton control situation, so I’m going to chalk it up as a “crit for 9999 by Alpha”, take it as a sign and move on for now. But thanks for the suggestion.

hmm… I tried to insert the demo code from the Nifty Standard Controls page, and it’s not working, I get:



[java]

2011.07.17. 10:52:37 de.lessvoid.nifty.loaderv2.types.ControlType internalApplyControl

WARNING: controlDefinition [radioButtonGroup] missing.

2011.07.17. 10:52:37 de.lessvoid.nifty.loaderv2.types.ControlType internalApplyControl

WARNING: controlDefinition [radioButton] missing.

2011.07.17. 10:52:37 de.lessvoid.nifty.loaderv2.types.ControlType internalApplyControl

WARNING: controlDefinition [radioButton] missing.

2011.07.17. 10:52:37 de.lessvoid.nifty.loaderv2.types.ControlType internalApplyControl

WARNING: controlDefinition [radioButton] missing.

2011.07.17. 10:52:37 de.lessvoid.nifty.loaderv2.types.ControlType internalApplyControl

WARNING: controlDefinition [radioButton] missing.

[/java]



Took a look at the contents of the jar file, and it seems that radio button is missing.

Yeah, that’s the conclusion I came to as well.

well, I’m sorry for the inconvenience but you’re probably using an old nifty or nifty-default-controls.jar.



The radioButton is available in the released jars for 1.3 and nifty 1.3 jars are available in jME3 nightly builds (I’ve only checked the latest jME3_2011-07-18 and it’s all in there). And the radioButton actually works in the controls example that is available online too :wink: so there’s probably simply a wrong jar somewhere…



The “nifty-radiobutton.xml” really IS in the “nifty-default-controls-1.3.jar”. I can see it :wink:

The version I’m using is the 1.3-SNAPSHOT.jar that came with jME when I downloaded a few weeks ago (not a nightly build).



But no worries, like I said before I think my use-case is a little more UI-heavy than most games, so Swing is probably a better choice anyway. (Just having much “fun” dealing with the threading and focus issues, as expected… ah well!)

swing is a good choice for out of game gui.

If you use swing for ingame gui, you will have focus issues, and it may be slower than nifty.

Also in nifty you can create a simple panel in 10 lines, in swing it needs 30-50 lines to make it good looking (aligning).

Not a game - this is a 3d editor for a game. :slight_smile:



I hear you regarding Swing verbosity, this is why I prefer a well documented xml-based UI layout, but given requirements Swing makes sense. The focus issues I’m trying to work out now (another thread just posted on this topic).

void256 said:
The "nifty-radiobutton.xml" really *IS* in the "nifty-default-controls-1.3.jar". I can see it ;)


indeed... I'm using your maven repo directly, and after changing the version from 1.3-SNAPSHOT to 1.3 release, the radiobutton appeared. :) Sorry for the complaint before looking around :)

Yep I had nifty-default-controls-1.3-SNAPSHOT.jar