How make a button pressed when corresponding key on a keyboard is pressed? JavaFX
问题 For example, I created a button labeled "1". Whenever this button is pressed, 1 is appended to a textField. However, I can add 1 to a textField simply by typing 1 on my keyboard. When doing so, I'd like by button to get view as if it was pressed instead if a key. I've been thinking thant may be it's possible to manage this issue in this way: rootNode.setOnKeyTyped(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { textField.appendText(event.getCharacter()); if(event