i write a javaFX program with a button named "okayButton" and every time i click on it, the program will print a message in Command Line.
My main question is how to use this button also by enter only when okayButton.isFocused() returns true
this is a part of my code. where click on button do it's work. same thing that i want by enter :
okayButton.setOnAction(event -> {
// Do what ever you want to your button do. Like :
System.Out.Print("Okay Button Fired (Clicked or Pressed");
}
);
and of course i can use Space Key that is default by java and also windows but i need Enter Key too.