Nifty update text - simple problem

Hello,



I have a very simple problem with Nifty GUI which I can’t resolve. I am very new to Nifty and have read various documentation and looked at some examples. I am trying to complete the following:


  1. User clicks panel with text
  2. Onclick the text on the panel is replaced with a String as specified by a Java method.



    I don’t know what I should be calling to update the text within the Nifty XML panel. I would appreciate any help based on the code below. Once I understand this basic principle I can proceed further with my project.



    Many thanks in advance!



    Mark



    Controller

    [java]

    import de.lessvoid.nifty.Nifty;

    import de.lessvoid.nifty.screen.Screen;

    import de.lessvoid.nifty.screen.ScreenController;



    public class TestScreenControllerv2 implements ScreenController {



    private String test = “Hello”;

    private Nifty nifty;



    public void bind(Nifty nifty, Screen screen) {

    this.nifty = nifty;

    }



    public void onStartScreen() {

    }

    public void onEndScreen() {

    }



    public void updateText(){



    test = test + “1”;



    //Code…

    //Update text in Nifty GUI

    //…

    System.out.println(test);

    }



    public String callThis() {

    return test;

    }

    }

    [/java]



    XML

    [xml]

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

    <nifty>

    <screen id=“start” controller=“test1.TestScreenControllerv2”>

    <layer id=“layer” backgroundColor="#0000" childLayout=“center”>

    <panel id=“panel” height=“20%” width=“100%” align=“center” valign=“bottom” backgroundColor="#FFFFFF" childLayout=“center” visibleToMouse=“true”>

    <interact onClick=“updateText()”/>

    <text id=“text” font=“aurulent-sans-17.fnt” color="#000f" text=“Text:, ${CALL.callThis()}!” align=“left” valign=“center” />

    </panel>

    </layer>

    </screen>

    </nifty>

    [/xml]

Always check the wiki, theres a link to this post in the NiftyGUI part.