Reputation: 581
Pressing on the Enter button is similar to mouse left click on focused node and pressing on Tab changes focused node. How can I disable it? I just want that these pressings do nothing.
Upvotes: 1
Views: 1493
Reputation: 759
Just try to installEventHandler
create under public void initFX(JFXPanel fxPanel)
, it will work for you
public void initFX(JFXPanel fxPanel) {
//.............
//............. your code
installEventHandler(scene);
}
then into installEventHandler(final Scene keyNode)
method
final EventHandler<javafx.scene.input.KeyEvent> keyEventHandler = new EventHandler<javafx.scene.input.KeyEvent>() {
public void handle(final javafx.scene.input.KeyEvent keyEvent) {
if (keyEvent.getCode() == KeyCode.ENTER) {
//do nothing
}
if (keyEvent.getCode() == KeyCode.TAB) {
//Do nothing
}
}
Upvotes: 1