Trouble with Nifty textfield in JMonkey program

I am having an issue with textfields using Nifty in my JMonkey program. Using Nifty solo works fine but when I use it with JMonkey, it seems I can no longer highlight the text using a mouse, select the position with the mouse (the cursor just always goes to the end), and when you type the cursor will go outside the textfield area and just keep moving indefinitely towards the right. I have tried both with everything (JMonkey, Nifty, etc) from the JME3-alpha2 bundle, and I also tried using the newer Nifty 1.2.

Any idea on what I am doing wrong? I have provided the code below which is from the Nifty demo, just very much stripped down (like I have removed the controller). All you have to do is change the path that the java file in calling the nifty xml file and the java package.



Thanks in advanced,

~David



EDIT: gah my xml was breaking… I had to escape all my greater-than/less-than signs





TextFIeldDemoMain.java

[java]

package nifty.testcase;



import com.jme3.app.SimpleApplication;

import com.jme3.niftygui.NiftyJmeDisplay;



public class TextFieldDemoMain extends SimpleApplication {



/**

  • {@inheritDoc}

    */

    @Override

    public void simpleInitApp() {

    this.flyCam.setEnabled(false);

    this.mouseInput.setCursorVisible(true);



    NiftyJmeDisplay niftyDisplay =

    new NiftyJmeDisplay(this.assetManager, this.inputManager, this.audioRenderer, this.viewPort);

    this.guiViewPort.addProcessor(niftyDisplay);



    niftyDisplay.getNifty().fromXml(“nifty/testcase/textfield.xml”, “start”);

    }

    public static void main(final String[] args) {

    new TextFieldDemoMain().start();

    }

    }

    [/java]



    textfield.xml

    [xml]

    <?xml version=“1.0” encoding=“UTF-8”?>

    <nifty xmlns=“http://nifty-gui.sourceforge.net/nifty.xsd” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd”>



    <!-- +++++++++++++++++++++++++++++++++++++++ -->

    <!-- load default styles and controls -->

    <!-- +++++++++++++++++++++++++++++++++++++++ -->

    <useStyles filename=“nifty-default-styles.xml” />

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



    <!-- +++++++++++++++++++++++++++++++++++++++ -->

    <!-- start screen -->

    <!-- +++++++++++++++++++++++++++++++++++++++ -->

    <screen id=“start”>

    <layer id=“layer” childLayout=“center”>

    <panel id=“dialog” style=“nifty-panel” padding=“20px,20px,20px,20px” childLayout=“center” width=“70%” height=“25%” align=“center” valign=“center”>

    <panel childLayout=“vertical” align=“center” valign=“center”>

    <panel childLayout=“horizontal”>

    <label text="Test Field: " width=“100px” align=“left” textVAlign=“center” textHAlign=“left”/>

    <control id=“field” name=“textfield” text=“test”/>

    </panel>

    </panel>

    </panel>

    </layer>

    </screen>

    </nifty>

    [/xml]