Button Help!?

hello :slight_smile:

i have this one more small question!

how to integrate a button with java file using nifty,

as in an example would be,

nifty wil display a button, defined in my .xml file,

and when the button is pressed a mouse event occurs, which should call a method in the java file, that will display a label saying, button clicked o sumfin, or open a new window, or something! (i dont want to display text on the button!)

(do i have to use any listener class or anything?

i read in the button section, but didnt understand it!

can some1 put some code example and help me out?

thanks! :slight_smile:

Ummm, I think this might be what you’re looking for…

[xml]<control id=”submitButton” type=”button”>

<interact onClick=”submit()” />


Just put that under your panel or something (in the XML file) and when it is clicked it’ll run the method submit() in your controller (.java file)… From the method you can call up a label or something (Tutorial).






Where the “& lt;” is replace it with a “<” and where the “& gt;” replace it with a “>”…


yea got it, thanks ! :slight_smile:

i’ll have a few more quesitons coming for u :stuck_out_tongue:

Guys, it would be better if you stopped using type=“stuff” and use the real tag which is name=“stuff”. Type was supposed to be removed at some point and there’s no guarantee it’ll stay there. Do yourselves a favor and fix it before it’s changed. :slight_smile: