Here is my code that set action for ctrl+c combination in JavaFX. It doesn't work when there is a focus on TextField command_line. Why?
public void setCtrlC() {
command_line.getScene().getAccelerators().put(new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_ANY),
new Runnable() {
@Override
public void run() {
LOGGER.debug("CTRL+C pressed");
try {
if (tab_toradex.isSelected()) {
bw.write(3);
bw.flush();
}
if(tab_novatel.isSelected()){
bw2.write(3);
bw2.flush();
}
} catch (IOException e) {
LOGGER.debug("CTRL+C command failed");
}
}
});
}
Thanks!