Nifty communication issue


I’m learning to use Nifty to make a good GUI for my game.

I have a little command line area that you can show by pressing the TAB button. So, it’s all OK (the area is displayed correctly) but the problem is: how can I send the text in the cmd line textfield to the game?

The Nifty XML is:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <useStyles filename="nifty-default-styles.xml" />
    <useControls filename="nifty-default-controls.xml" />
    <screen id="cmd" controller="mygame.appstates.main.MenuAppState">
        <layer id="layer" backgroundColor="#0000" childLayout="center">
            <panel id="panel" height="3%" width="100%" align="center" valign="bottom" backgroundColor="#fff1" childLayout="center" visibleToMouse="true">
                <control name="textfield" text="Enter Command">

Nifty initialization:

private NiftyJmeDisplay niftyDisplay;

protected void prepareNifty(){
    niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, app.getAudioRenderer(), guiViewPort);
    nifty = niftyDisplay.getNifty();
    nifty.fromXml("Interface/NiftyGUI/cmd.xml", "cmd", this);

Nifty attach (in the update() method):

if(niftyDisplay != null){
    } else {

I also followed the jme Nifty guide (
And also: TextField · nifty-gui/nifty-gui Wiki · GitHub
But it didn’t help me.

Thank you!

I’m not sure what you tried since you don’t show any code from your controller. That being said, your link to the textfield class tells you the event you need to listen for. In your first link there is also a link to the nifty gui manual which has documentation about how the event system in nifty works.