javafx action event enter key

Solutions on MaxInterview for javafx action event enter key by the best coders in the world

showing results for - "javafx action event enter key"
Aileen
13 Oct 2018
1import javafx.event.ActionEvent;
2import javafx.event.EventHandler;
3import javafx.scene.input.KeyEvent;
4import javafx.scene.input.KeyCode;
5
6btn.setOnKeyPressed(new EventHandler<KeyEvent>() {
7        @Override
8        public void handle(KeyEvent k) {
9            if (k.getCode().equals(KeyCode.ENTER)) {
10                doSomething();
11            }
12        }
13});