Is it possible to simply check if a key is currently pressed in JavaFX without listening for a KeyEvent? In my case I want to check if a key is down while a button is being pressed.
button.setOnAction(e -> {
// This is where I want to check if a specific key is currently down.
if(keyIsDown) {
// do something
} else {
// do something else
}
});
I can think of a couple of workarounds. I'm just wondering if there is a right way to do this.