NIfty GUI highlight default button

Hello! I created nifty gui buttons and the on of the button is highlight. How coud I remove the highlight so no anyone high-lightened. Thanks in advance!

I’m not quite sure I understand you, but I think this should solve your problem:

screen.getFocusHandler().resetFocusElements();

Also, if you don’t want buttons to receive focus (which can be especially annoying if you use the spacebar or tab key for something else), you can use focusable=“false” on the button control in the xml.

1 Like

I think he is talking about the hightlight event when the mouse is moved over the button. It looks it’s an interaction event of a panel element of the button control deffinition. You could remove this interaction event by hand in java, by retrieving that panel element and using some method to remove the event, or creating a custom button control deffinition…

1 Like

Thanks guys! For the answers.

Both the focus highlight and the mouseover highlight are done via the style. So perhaps the easiest way is to create a custom style, which you’d want to do eventually anyway.

In the button section of the style there should be a png (button.png if I remember correct). This is a png with three areas, one for normal, one for focussed and one for mouseover. If you make those three areas in the png identical, you’d have no more difference between normal, focus and mouseover.



This is the cleanest way, since it doesn’t require any java coding. However, if what you actually want is to remove the ability to set the focus to the buttong, then @glaucomardano is right.