Nifty Gui call method with perameters

So I have recently started to learn nifty and I require something where if you press a button it will print a string and if you press another button another string gets printed.

I don’t want to make 2 separate methods, How do I do this with one method

public void printing(String i) {
System.out.println(i);
}

XML

....
<panel id="panel_bottom_left" height="50%" width="50%" valign="center" backgroundColor="#f60f"             childLayout="center" visibleToMouse="true">  
      
<interact onClick="printing("Hi")"/>
   
</panel>

<panel id="panel_bottom_1" height="50%" width="30%" valign="center" backgroundColor="#f00f" childLayout="center" visibleToMouse="true">  
      
<interact onClick="printing("Bye")"/>
   
</panel>

That is the way to go. Just loose the extra quote marks.

<interact onClick="printing("Bye")"/> -> <interact onClick="printing(Bye)"/>
1 Like

thanks it worked