dimanche 30 mars 2014

Triggering an Event by KeyCombination in javaFX


Vote count:

0




I am trying to set a shortcut to save a file.



public static final KeyCombination saveShortcut = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_ANY);


I trigger an action by:



sceneRoot.addEventHandler(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (saveShortcut.match(event)) {
saveProject.fire();
}
}

});


However, the event gets fired anytime I hit "S". Any ideas on why so?



asked 1 min ago






1 commentaire: