I have a button on a Scene, that whenever the space bar or enter key is pressed, this button automatically fires. I want the user to be able to type these keys without this button firing. I have already tried doing root.requestFocus()
and calling the request focus method on other nodes in my scene. How can I prevent this button from firing when these keys are pressed. Thanks for any help.
Edit:
So far I have just done the boiler plate code to make a Javafx application work, added that button and a few labels. I have tried the requestFocus() method in several nodes in my application, none of which has made a difference. I also have a scene.setOnKeyPressed
action event listener for keys pressed.