scene = new Scene(300, 300) {
val btn_startstop = new Button("Start")
onKeyPressed = (ev:KeyEvent) => {
if( ev.code == KeyCode.LEFT ) {
}
}
content = List(btn_startstop)
}
This works with “normal” keys like the a-z keys, but not with the cursor keys. These seem to be catched away by the button. When I remove the button, cursor key presses are then also catched by the scene.
How can i prevent the button to capture any key presses? It shall react only to mouse clicks.
You may want to also ask about this in a JavaFX community – IIRC, ScalaFX is a fairly thin shell around JavaFX, so this is probably an issue in the underlying library.