[Nifty] Radio Buttons and Password Font

Hello, I am having difficulty finding reference to a control or built in element for a radio button in nifty (i upgraded myself to 1.3 if that still isnt the standard around here)



The other problem I am having is that I need a way to turn the font of a textfield control into some kind of password font so that passwords being entered cannot be seen.



Does anyone know anything about how to access these? I appreciate the help.



Thank you

About the passwordfield:

In Nifty 1.2 you could do it like this

[xml]<control id="loginPassword" name="textfield" passwordChar="*"

maxLength="30" />[/xml]

that’s still the same in nifty 1.3

thanks for the help, I just ran into a problem though. Seems loginPassword is not a defined control.



[java]Feb 8, 2011 12:02:50 PM de.lessvoid.nifty.loaderv2.types.ControlType internalApplyControl

WARNING: controlDefinition [loginPassword] missing.

Feb 8, 2011 12:02:50 PM de.lessvoid.nifty.loaderv2.types.ControlType internalApplyControl

WARNING: controlDefinition [loginPassword] missing.

java.util.NoSuchElementException

at java.util.AbstractList$Itr.next(AbstractList.java:350)

at de.lessvoid.nifty.loaderv2.types.ControlType.makeFlatControlsInternal(ControlType.java:66)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:362)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:360)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:360)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:360)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:360)

at de.lessvoid.nifty.loaderv2.types.ElementType.makeFlatControls(ElementType.java:360)

at de.lessvoid.nifty.loaderv2.types.ElementType.prepare(ElementType.java:320)

at de.lessvoid.nifty.loaderv2.types.ScreenType.create(ScreenType.java:64)

at de.lessvoid.nifty.loaderv2.types.NiftyType.create(NiftyType.java:118)

at de.lessvoid.nifty.Nifty.loadFromFile(Nifty.java:410)

at de.lessvoid.nifty.Nifty.fromXml(Nifty.java:336)

at mygame.Main.initDisplay(Main.java:86)

at mygame.Main.simpleInitApp(Main.java:54)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:186)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:134)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:183)

at java.lang.Thread.run(Thread.java:619)[/java]

could you paste the java code you use to gain access to the controll as well as the xml code?

So I have been thinking about this before I post my response, and I realized that since I manually upgraded my Nifty to 1.3 a while ago, it has not been getting updated. I checked and I have a version from like november 2010, so I would assume alot has changed since then.



Now… all I did was re-download the latest of these 3 files from these locations:



[java]* Index of /nifty-maven-repo/lessvoid/nifty

  • Index of /nifty-maven-repo/lessvoid/nifty-default-controls
  • Index of /nifty-maven-repo/lessvoid/nifty-style-black

    [/java]



    and replaced my old ones.



    However, now when I recompile, I am getting an error when I attempt to run my program…



    [java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

    java.lang.NoClassDefFoundError: org/bushe/swing/event/EventService

    at com.jme3.niftygui.NiftyJmeDisplay.<init>(NiftyJmeDisplay.java:79)

    at mygame.Main.initDisplay(Main.java:87)

    at mygame.Main.simpleInitApp(Main.java:54)

    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:218)

    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:136)

    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:193)

    at java.lang.Thread.run(Thread.java:619)

    Caused by: java.lang.ClassNotFoundException: org.bushe.swing.event.EventService

    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

    … 7 more[/java]



    where Main.java:87 is

    [java] NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,inputManager,audioRenderer,guiViewPort);[/java]



    I just updated my JME, 2 days ago. Does anyone know what could be causing this? When I switch back to my old Nifty from November this problem goes away.



    Thanks!

Nifty 1.3 now requires a new library called eventbus, make sure you include it in your classpath

so I got the .jar files for 1.3 and 1.4 to try from this website



http://repo2.maven.org/maven2/org/bushe/eventbus/



(hope it is the correct library)



both version 1.3 and 1.4 give me this same error when in my classpath:



[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.AbstractMethodError: com.jme3.niftygui.RenderDeviceJme.createMouseCursor(Ljava/lang/String;II)Lde/lessvoid/nifty/spi/render/MouseCursor;

at de.lessvoid.nifty.render.NiftyMouseImpl.registerMouseCursor(NiftyMouseImpl.java:25)

at de.lessvoid.nifty.loaderv2.types.RegisterMouseCursorType.materialize(RegisterMouseCursorType.java:16)

at de.lessvoid.nifty.loaderv2.types.NiftyStylesType.loadStyles(NiftyStylesType.java:31)

at de.lessvoid.nifty.loaderv2.NiftyLoader.loadStyleFile(NiftyLoader.java:92)

at de.lessvoid.nifty.loaderv2.types.UseStylesType.loadStyle(UseStylesType.java:13)

at de.lessvoid.nifty.loaderv2.types.NiftyStylesType.loadStyles(NiftyStylesType.java:34)

at de.lessvoid.nifty.loaderv2.NiftyLoader.loadStyleFile(NiftyLoader.java:92)

at de.lessvoid.nifty.loaderv2.types.UseStylesType.loadStyle(UseStylesType.java:13)

at de.lessvoid.nifty.loaderv2.types.NiftyType.loadStyles(NiftyType.java:144)

at de.lessvoid.nifty.loaderv2.NiftyLoader.loadNiftyXml(NiftyLoader.java:48)

at de.lessvoid.nifty.Nifty.loadFromFile(Nifty.java:432)

at de.lessvoid.nifty.Nifty.fromXml(Nifty.java:359)

at mygame.Main.initDisplay(Main.java:91)

at mygame.Main.simpleInitApp(Main.java:54)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:218)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:136)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:193)

at java.lang.Thread.run(Thread.java:619)[/java]



where Main.java:91 is

[java]nifty.fromXml("GUI/space_GUI.xml", "side_panel", mh.sm);[/java]



heh… Am I missing something or get the wrong jar file?

Thanks for the quick replies.

Nifty 1.3 is currently incompatible with jME3.

There’s some (small) changes that have to be made in the source.